summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Van Hees <kris.van.hees@oracle.com>2025-03-07 11:53:28 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-20 10:15:44 +0200
commite94314b727683f2b2d969a85e88d730caa7fe180 (patch)
tree3317d4bd2980d8cc4091692034cd86d59e1cb2b9
parent9eaec071f111cd2124ce9a5b93536d3f6837d457 (diff)
kbuild: exclude .rodata.(cst|str)* when building ranges
commit 87bb368d0637c466a8a77433837056f981d01991 upstream. The .rodata.(cst|str)* sections are often resized during the final linking and since these sections do not cover actual symbols there is no need to include them in the modules.builtin.ranges data. When these sections were included in processing and resizing occurred, modules were reported with ranges that extended beyond their true end, causing subsequent symbols (in address order) to be associated with the wrong module. Fixes: 5f5e7344322f ("kbuild: generate offset range data for builtin modules") Cc: stable@vger.kernel.org Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Jack Vogel <jack.vogel@oracle.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rwxr-xr-xscripts/generate_builtin_ranges.awk5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/generate_builtin_ranges.awk b/scripts/generate_builtin_ranges.awk
index b9ec761b3bef..d4bd5c2b998c 100755
--- a/scripts/generate_builtin_ranges.awk
+++ b/scripts/generate_builtin_ranges.awk
@@ -282,6 +282,11 @@ ARGIND == 2 && !anchor && NF == 2 && $1 ~ /^0x/ && $2 !~ /^0x/ {
# section.
#
ARGIND == 2 && sect && NF == 4 && /^ [^ \*]/ && !($1 in sect_addend) {
+ # There are a few sections with constant data (without symbols) that
+ # can get resized during linking, so it is best to ignore them.
+ if ($1 ~ /^\.rodata\.(cst|str)[0-9]/)
+ next;
+
if (!($1 in sect_base)) {
sect_base[$1] = base;