MIPS: Avoid dead code/data elimination when using recordmcount
PATCH 1/1 MIPS: Avoid dead code/data elimination when using recordmcount
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION builds with -ffunction-sections, placing every function in its own section. recordmcount refuses to use weak symbols as section bases, as a strong definition could override them, so a weak function alone in its section, such as the generic pcibios_fixup_bus() stub, breaks the build:
Cannot find symbol for section 88: .text.pcibios_fixup_bus. drivers/pci/probe.o: failed
MIPS always records mcount locations with recordmcount, so this hits any config with the function tracer and dead code elimination enabled, e.g. malta_defconfig built with LLVM=1.
Only offer dead code elimination when recordmcount is not used, as powerpc does since commit f8b2336f15f3 ("powerpc: Avoid dead code/data elimination when using recordmcount"). In practice this makes it unavailable together with the function tracer on MIPS.
--- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/Kconfig +1 -1
@@ -79,7 +79,7 @@ config MIPS select HAVE_IRQ_TIME_ACCOUNTING select HAVE_KPROBES select HAVE_KRETPROBES - select HAVE_LD_DEAD_CODE_DATA_ELIMINATION + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !FTRACE_MCOUNT_USE_RECORDMCOUNT select HAVE_MOD_ARCH_SPECIFIC select HAVE_NMI select HAVE_PAGE_SIZE_4KB if !CPU_LOONGSON2EF && !CPU_LOONGSON64
Signature · 1 line
2.56.0
Quoted 39 lines · Rosen Penev
CONFIG_LD_DEAD_CODE_DATA_ELIMINATIONbuilds with -ffunction-sections, placing every function in its own section. recordmcount refuses to use weak symbols as section bases, as a strong definition could override them, so a weak function alone in its section, such as the genericpcibios_fixup_bus()stub, breaks the build:Cannot find symbol for section 88: .text.pcibios_fixup_bus.
drivers/pci/probe.o: failedMIPS always records mcount locations with recordmcount, so this hits any config with the function tracer and dead code elimination enabled, e.g.
malta_defconfigbuilt with LLVM=1.Only offer dead code elimination when recordmcount is not used, as powerpc does since commit
f8b2336f15f3("powerpc: Avoid dead code/data elimination when using recordmcount"). In practice this makes it unavailable together with the function tracer on MIPS.Fixes c0436b503591 ("MIPS: Enable dead code elimination")Signed-off-by Rosen Penev <[email protected]>--- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/mips/Kconfig +1
-1@@ -79,7 +79,7 @@ config MIPS select HAVE_IRQ_TIME_ACCOUNTING select HAVE_KPROBES select HAVE_KRETPROBES - select HAVE_LD_DEAD_CODE_DATA_ELIMINATION + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !FTRACE_MCOUNT_USE_RECORDMCOUNT select HAVE_MOD_ARCH_SPECIFIC select HAVE_NMI select HAVE_PAGE_SIZE_4KB if !CPU_LOONGSON2EF && !CPU_LOONGSON64Signature · 1 line
2.56.0
applied to mips-fixes
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]