powerpc/ftrace: Disable ftrace on ppc32 if using clang
authorNaveen N Rao <naveen@kernel.org>
Fri, 9 Jun 2023 03:45:01 +0000 (09:15 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 19 Jun 2023 07:37:13 +0000 (17:37 +1000)
Ftrace on ppc32 expects a three instruction sequence at the beginning of
each function when specifying -pg:
mflr r0
stw r0,4(r1)
bl _mcount

This is the case with all supported versions of gcc. Clang however emits
a branch to _mcount after the function prologue, similar to the pre
-mprofile-kernel ABI on ppc64. This is not supported.

Disable ftrace on ppc32 if using clang for now. This can be re-enabled
later if clang picks up support for -fpatchable-function-entry on ppc32.

Signed-off-by: Naveen N Rao <naveen@kernel.org>
Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://github.com/llvm/llvm-project/issues/63220
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230609034501.407971-1-naveen@kernel.org
arch/powerpc/Kconfig

index dea8e0c..8b955bc 100644 (file)
@@ -236,7 +236,7 @@ config PPC
        select HAVE_FUNCTION_DESCRIPTORS        if PPC64_ELF_ABI_V1
        select HAVE_FUNCTION_ERROR_INJECTION
        select HAVE_FUNCTION_GRAPH_TRACER
-       select HAVE_FUNCTION_TRACER
+       select HAVE_FUNCTION_TRACER             if PPC64 || (PPC32 && CC_IS_GCC)
        select HAVE_GCC_PLUGINS                 if GCC_VERSION >= 50200   # plugin support on gcc <= 5.1 is buggy on PPC
        select HAVE_GENERIC_VDSO
        select HAVE_HARDLOCKUP_DETECTOR_ARCH    if PPC_BOOK3S_64 && SMP