All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tri Vo <trong@android.com>
To: linux@armlinux.org.uk, yamada.masahiro@socionext.com
Cc: linux-arm-kernel@lists.infradead.org, ndesaulniers@google.com,
	linux-kernel@vger.kernel.org, stefan@agner.ch,
	Tri Vo <trong@android.com>
Subject: [PATCH] ARM: disable FUNCTION_TRACER when building with Clang
Date: Wed, 22 May 2019 17:56:57 -0700	[thread overview]
Message-ID: <20190523005657.170008-1-trong@android.com> (raw)

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 --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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Tri Vo <trong@android.com>
To: linux@armlinux.org.uk, yamada.masahiro@socionext.com
Cc: ndesaulniers@google.com, stefan@agner.ch,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Tri Vo <trong@android.com>
Subject: [PATCH] ARM: disable FUNCTION_TRACER when building with Clang
Date: Wed, 22 May 2019 17:56:57 -0700	[thread overview]
Message-ID: <20190523005657.170008-1-trong@android.com> (raw)

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 --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


             reply	other threads:[~2019-05-23  0:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23  0:56 Tri Vo [this message]
2019-05-23  0:56 ` [PATCH] ARM: disable FUNCTION_TRACER when building with Clang Tri Vo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190523005657.170008-1-trong@android.com \
    --to=trong@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=ndesaulniers@google.com \
    --cc=stefan@agner.ch \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.