Skip to contentSkip to conversation

kbuild: lto: add _mcount to list of used symbols

PATCH In review Arnd Bergmann 3 participants 3 messages Feb 25, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: lto: add _mcount to list of used symbols

From: Arnd Bergmann <[email protected]>

Some randconfig builds fail with undefined references to _mcount when CONFIG_TRIM_UNUSED_KSYMS is set:

ERROR: modpost: "_mcount" [drivers/tee/optee/optee.ko] undefined!
ERROR: modpost: "_mcount" [drivers/fsi/fsi-occ.ko] undefined!
ERROR: modpost: "_mcount" [drivers/fpga/dfl-pci.ko] undefined!

Since there is already a list of symbols that get generated at link time, add this one as well.

Fixes fbe078d397b4 ("kbuild: lto: add a default list of used symbols")
---
 scripts/lto-used-symbollist.txt | 1 +
 1 file changed, 1 insertion(+)
scripts/lto-used-symbollist.txt +1 -0
index 38e7bb9ebaae..406ada65e926 100644
@@ -1,5 +1,6 @@
 memcpy
 memmove
 memset
+_mcount
 __stack_chk_fail
 __stack_chk_guard
Signature · 1 line
2.29.2
#1 lore raw
Quoted 31 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Some randconfig builds fail with undefined references to _mcount when CONFIG_TRIM_UNUSED_KSYMS is set:

ERROR: modpost: "_mcount" [drivers/tee/optee/optee.ko] undefined!
ERROR: modpost: "_mcount" [drivers/fsi/fsi-occ.ko] undefined!
ERROR: modpost: "_mcount" [drivers/fpga/dfl-pci.ko] undefined!

Since there is already a list of symbols that get generated at link time, add this one as well.

Fixes fbe078d397b4 ("kbuild: lto: add a default list of used symbols")
---
 scripts/lto-used-symbollist.txt | 1 +
 1 file changed, 1 insertion(+)
scripts/lto-used-symbollist.txt +1 -1
index 38e7bb9ebaae..406ada65e926 100644
@@ -1,5 +1,6 @@
 memcpy
 memmove
 memset
+_mcount
 __stack_chk_fail
 __stack_chk_guard
--
Quoted 2 lines

2.29.2

Applied to linux-kbuild/fixes. Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Some randconfig builds fail with undefined references to _mcount when CONFIG_TRIM_UNUSED_KSYMS is set:

ERROR: modpost: "_mcount" [drivers/tee/optee/optee.ko] undefined!
ERROR: modpost: "_mcount" [drivers/fsi/fsi-occ.ko] undefined!
ERROR: modpost: "_mcount" [drivers/fpga/dfl-pci.ko] undefined!

Quoted 5 lines

Since there is already a list of symbols that get generated at link time, add this one as well.

Fixes fbe078d397b4 ("kbuild: lto: add a default list of used symbols")

Thanks!

Signature · 1 line
Kees Cook