Skip to content

Commit 29500f1

Browse files
committed
kbuild: fix CONFIG_TRIM_UNUSED_KSYMS build for ppc64
Stephen Rothwell reported a build error on ppc64 when CONFIG_TRIM_UNUSED_KSYMS is enabled. Jessica Yu pointed out the cause of the error with the reference to the ppc64 ELF ABI: "Symbol names with a dot (.) prefix are reserved for holding entry point addresses. The value of a symbol named ".FN", if it exists, is the entry point of the function "FN". As it turned out, CONFIG_TRIM_UNUSED_KSYMS has never worked for ppc64, but this issue has been unnoticed until recently because this option depends on !UNUSED_SYMBOLS hence is disabled by all{mod,yes}config. (Then, it was uncovered by another patch removing UNUSED_SYMBOLS.) Removing the dot prefix in scripts/gen_autoksyms.sh fixes the issue. Please note it must be done before 'sort -u' because modules have both ._mcount and _mcount undefined when CONFIG_FUNCTION_TRACER=y. Link: https://lore.kernel.org/lkml/[email protected]/ Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Jessica Yu <[email protected]>
1 parent 92bf226 commit 29500f1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/gen_autoksyms.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ EOT
4343
sed 's/ko$/mod/' $modlist |
4444
xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- |
4545
cat - "$ksym_wl" |
46+
# Remove the dot prefix for ppc64; symbol names with a dot (.) hold entry
47+
# point addresses.
48+
sed -e 's/^\.//' |
4649
sort -u |
4750
sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$output_file"
4851

0 commit comments

Comments
 (0)