diff mbox series

ARM: disable FUNCTION_TRACER when building with Clang

Message ID 20190523005657.170008-1-trong@android.com (mailing list archive)
State New, archived
Headers show
Series ARM: disable FUNCTION_TRACER when building with Clang | expand

Commit Message

Tri Vo May 23, 2019, 12:56 a.m. UTC
Clang needs "-meabi gnu" flag to emit calls to "__gnu_mcount_nc".
Otherwise, it inserts calls to undefined "mcount".

  kernel/softirq.o: In function `_local_bh_enable':
  ...
  undefined reference to `mcount'

"-meabi gnu" resolves link failures.  However, Clang does not implement
calls to "__gnu_mcount_nc" correctly.  It does not save the link
register on the stack, which corrupts the stack.  The resulting kernel
does not boot.

Disable FUNCTION_TRACER support when building with Clang.

Link: https://github.com/ClangBuiltLinux/linux/issues/35
Suggested-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Tri Vo <trong@android.com>
---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8869742a85df..7a1804392795 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -75,7 +75,7 @@  config ARM
 	select HAVE_EXIT_THREAD
 	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
 	select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
-	select HAVE_FUNCTION_TRACER if !XIP_KERNEL
+	select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !CC_IS_CLANG
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
 	select HAVE_IDE if PCI || ISA || PCMCIA