[PATCH] ARM: disable FUNCTION_TRACER when building with Clang

From: Tri Vo
Date: Wed May 22 2019 - 21:00:06 EST


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@xxxxxxxx>
Signed-off-by: Tri Vo <trong@xxxxxxxxxxx>
---
arch/arm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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
--
2.21.0.1020.gf2820cf01a-goog