diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2025-04-14 08:03:21 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2025-04-15 08:30:57 +0000 |
| commit | 9117e5af6f73d893bff315f64d797ff6466146eb (patch) | |
| tree | 6215e64432807cdb67183c663104a6e51d6df872 /pkg/declextract | |
| parent | 93db339b43e883b4f87a3b0617e2f8a3f8eb313b (diff) | |
pkg/declextract: add a hack for kernel/sched files compiled together
To optimize build time kernel/sched compiles a number of source files together
by including them into another source file. As the result static functions
declared in one source file effectively referenced from another source file.
In order to be able to resolve them, we pretend such functions are not static.
Diffstat (limited to 'pkg/declextract')
| -rw-r--r-- | pkg/declextract/entity.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/declextract/entity.go b/pkg/declextract/entity.go index eb3bc4d7c..d52d265f4 100644 --- a/pkg/declextract/entity.go +++ b/pkg/declextract/entity.go @@ -8,6 +8,7 @@ import ( "crypto/sha256" "encoding/json" "slices" + "strings" ) type Output struct { @@ -249,6 +250,13 @@ func (out *Output) SortAndDedup() { func (out *Output) SetSourceFile(file string, updatePath func(string) string) { for _, fn := range out.Functions { fn.File = updatePath(fn.File) + // To optimize build time kernel/sched compiles a number of source files together + // by including them into another source file. As the result static functions + // declared in one source file effectively referenced from another source file. + // In order to be able to resolve them, we pretend such functions are not static. + if strings.HasSuffix(fn.File, ".c") && fn.File != file { + fn.IsStatic = false + } } for _, ci := range out.Consts { ci.Filename = updatePath(ci.Filename) |
