summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDmitry Kandybka <d.kandybka@gmail.com>2026-10-26 10:47:33 +0300
committerNicolas Schier <nsc@kernel.org>2026-11-05 07:36:22 +0100
commit131d86d09b60b9df66adfff06152e52414f3ed94 (patch)
treec50fb7d1a6aee1be8ec7fe7e03a461727337977d /scripts
parentfa68f88e6dfa8868c816bde8f289e54efc20ab96 (diff)
downloadlinux-next-131d86d09b60b9df66adfff06152e52414f3ed94.tar.gz
linux-next-131d86d09b60b9df66adfff06152e52414f3ed94.zip
kbuild: Makefile.lib: fix offsets generation with debug info
When debug information is enabled (e.g. -ggdb3), the assembler output file (e.g. kernel/sched/rq-offsets.s) contains additional directives such as .ascii with offset info and debug metadata. For example: .ascii "->RQ_nr_pinned $3048 offsetof(struct rq, nr_pinned)" # ... .ascii "->func); __data = (it_func_ptr)->data; ((void(*)(void *, pro" The current sed-offsets macro uses [^ ]* to match constant names, which is too permissive and can match unexpected characters when debug directives are present. Additionally, the fallback command 's:->::; p;' strips '->' from any unmatched line and prints it, which causes debug metadata to leak into the generated header file (include/generated/rq-offsets.h), breaking the build. Replace [^ ]* with [[:alnum:]_]* to match only valid C identifiers, and remove the fallback 's:->::' command so that only successfully transformed lines are emitted into the generated header. Fixes: 7dd47b95b0f5 ("kbuild: consolidate redundant sed script ASM offset generation") Signed-off-by: Dmitry Kandybka <d.kandybka@gmail.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20261026074733.11777-1-d.kandybka@gmail.com Signed-off-by: Nicolas Schier <nsc@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 19e96b30a122..16fdbef21890 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -493,9 +493,9 @@ quiet_cmd_zstd22_with_size = ZSTD22 $@
# the .ascii directive whereas GCC keeps the <space> as-is.
define sed-offsets
's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; \
- /^->/{s:->#\(.*\):/* \1 */:; \
- s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
- s:->::; p;}'
+ /^->/{s:->#\(.*\):/* \1 */:p; \
+ s:^->\([[:alnum:]_]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:p; \
+ s:^->BLANK()::p;}'
endef
# Use filechk to avoid rebuilds when a header changes, but the resulting file