* [PATCH] MIPS: Avoid dead code/data elimination when using recordmcount
@ 2026-10-04 23:48 Rosen Penev
2026-11-05 15:23 ` Thomas Bogendoerfer
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-10-04 23:48 UTC (permalink / raw)
To: linux-mips
Cc: Thomas Bogendoerfer, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt, Paul Burton, open list,
open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
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.
Fixes: c0436b503591 ("MIPS: Enable dead code elimination")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
arch/mips/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index ddabe25d6bf7..f4f82bd75b66 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -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
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] MIPS: Avoid dead code/data elimination when using recordmcount
2026-10-04 23:48 [PATCH] MIPS: Avoid dead code/data elimination when using recordmcount Rosen Penev
@ 2026-11-05 15:23 ` Thomas Bogendoerfer
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2026-11-05 15:23 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-mips, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
Justin Stitt, Paul Burton, open list,
open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
On Sun, Oct 04, 2026 at 04:48:26PM -0700, Rosen Penev wrote:
> 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.
>
> Fixes: c0436b503591 ("MIPS: Enable dead code elimination")
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> arch/mips/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index ddabe25d6bf7..f4f82bd75b66 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -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
> --
> 2.56.0
applied to mips-fixes
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-05 15:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-04 23:48 [PATCH] MIPS: Avoid dead code/data elimination when using recordmcount Rosen Penev
2026-11-05 15:23 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®