kbuild: add symbol prefix arg to kallsyms
PATCH 1/1 kbuild: add symbol prefix arg to kallsyms
Commit 1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123 ("kbuild: link of vmlinux moved to a script") introduced in v3.5-rc1 broke kallsyms on architectures which have symbol prefixes.
The --symbol-prefix argument used to be added to the KALLSYMS command line from the architecture Makefile, however this isn't picked up by the new scripts/link-vmlinux.sh. This resulted in symbols like kallsyms_addresses being added which weren't correctly overriding the weak symbols such as _kallsyms_addresses. These could then trigger BUG_ONs in kallsyms code.
This is fixed by removing the KALLSYMS addition from the architecture Makefile, and using CONFIG_SYMBOL_PREFIX in the link-vmlinux.sh script to determine whether to add the --symbol-prefix argument.
--- arch/blackfin/Makefile | 1 - scripts/link-vmlinux.sh | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/blackfin/Makefile +0 -1
@@ -20,7 +20,6 @@ endif KBUILD_AFLAGS += $(call cc-option,-mno-fdpic) KBUILD_CFLAGS_MODULE += -mlong-calls LDFLAGS += -m elf32bfin -KALLSYMS += --symbol-prefix=_ KBUILD_DEFCONFIG := BF537-STAMP_defconfig
scripts/link-vmlinux.sh +6 -1
@@ -74,8 +74,13 @@ kallsyms() info KSYM ${2} local kallsymopt; + if [ -n "${CONFIG_SYMBOL_PREFIX}" ]; then + kallsymopt="${kallsymopt} \ + --symbol-prefix=${CONFIG_SYMBOL_PREFIX}" + fi + if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then - kallsymopt=--all-symbols + kallsymopt="${kallsymopt} --all-symbols" fi local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
Signature · 1 line
1.7.7.6
Hi James,
Quoted 11 lines · James Hogan
Commit
1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123("kbuild: link of vmlinux moved to a script") introduced in v3.5-rc1 broke kallsyms on architectures which have symbol prefixes.The --symbol-prefix argument used to be added to the KALLSYMS command line from the architecture
Makefile, however this isn't picked up by the newscripts/link-vmlinux.sh. This resulted in symbols likekallsyms_addressesbeing added which weren't correctly overriding the weak symbols such as_kallsyms_addresses. These could then triggerBUG_ONsin kallsyms code.
Quoted 5 lines
This is fixed by removing the KALLSYMS addition from the architecture
Makefile, and usingCONFIG_SYMBOL_PREFIXin thelink-vmlinux.shscript to determine whether to add the --symbol-prefix argument.Signed-off-by James Hogan <[email protected]>
Yes, we also found this issue. Thank you for your fix. I'll apply it soon.
Quoted 43 lines
--- arch/blackfin/Makefile | 1 - scripts/link-vmlinux.sh | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-)arch/blackfin/Makefile +0
-1@@ -20,7 +20,6 @@ endif KBUILD_AFLAGS += $(call cc-option,-mno-fdpic) KBUILD_CFLAGS_MODULE += -mlong-calls LDFLAGS += -m elf32bfin -KALLSYMS += --symbol-prefix=_ KBUILD_DEFCONFIG := BF537-STAMP_defconfigscripts/link-vmlinux.sh +6
-2@@ -74,8 +74,13 @@ kallsyms() info KSYM ${2} local kallsymopt; + if [ -n "${CONFIG_SYMBOL_PREFIX}" ]; then + kallsymopt="${kallsymopt} \ + --symbol-prefix=${CONFIG_SYMBOL_PREFIX}" + fi + if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then - kallsymopt=--all-symbols + kallsymopt="${kallsymopt} --all-symbols" fi local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ --1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Regards, --Bob
Quoted 11 lines · James Hogan
Commit
1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123("kbuild: link of vmlinux moved to a script") introduced in v3.5-rc1 broke kallsyms on architectures which have symbol prefixes.The --symbol-prefix argument used to be added to the KALLSYMS command line from the architecture
Makefile, however this isn't picked up by the newscripts/link-vmlinux.sh. This resulted in symbols likekallsyms_addressesbeing added which weren't correctly overriding the weak symbols such as_kallsyms_addresses. These could then triggerBUG_ONsin kallsyms code.
Quoted 5 lines
This is fixed by removing the KALLSYMS addition from the architecture
Makefile, and usingCONFIG_SYMBOL_PREFIXin thelink-vmlinux.shscript to determine whether to add the --symbol-prefix argument.Signed-off-by James Hogan <[email protected]>
Sam