From 9117e5af6f73d893bff315f64d797ff6466146eb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 14 Apr 2025 08:03:21 +0200 Subject: 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. --- pkg/declextract/entity.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkg') 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) -- cgit mrf-deployment