linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: require GCC for FRAME_POINTER
@ 2018-08-11  9:52 Stefan Agner
  2018-08-13 21:12 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Agner @ 2018-08-11  9:52 UTC (permalink / raw)
  To: linux; +Cc: arnd, mka, linux-arm-kernel, linux-kernel, Stefan Agner

To produce a meaningful backtrace with FRAME_POINTER enabled the
kernel needs a specific function prologue:
    mov    ip, sp
    stmfd    sp!, {fp, ip, lr, pc}
    sub    fp, ip, #4

To get to the required prologue gcc uses apcs and no-sched-prolog.
This compiler options are not available on clang, and clang is not
able to generate the required prologue. Make the FRAME_POINTER
config symbol dependent on GCC.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arch/arm/Kconfig.debug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 693f84392f1b..cb65cf67dfa2 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -54,7 +54,7 @@ config DEBUG_WX
 # n, but then RMK will have to kill you ;).
 config FRAME_POINTER
 	bool
-	depends on !THUMB2_KERNEL
+	depends on !THUMB2_KERNEL && CC_IS_GCC
 	default y if !ARM_UNWIND || FUNCTION_GRAPH_TRACER
 	help
 	  If you say N here, the resulting kernel will be slightly smaller and
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: require GCC for FRAME_POINTER
  2018-08-11  9:52 [PATCH] ARM: require GCC for FRAME_POINTER Stefan Agner
@ 2018-08-13 21:12 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2018-08-13 21:12 UTC (permalink / raw)
  To: Stefan Agner
  Cc: Russell King - ARM Linux, Matthias Kaehlcke, Linux ARM,
	Linux Kernel Mailing List

On Sat, Aug 11, 2018 at 11:52 AM Stefan Agner <stefan@agner.ch> wrote:
>

> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 693f84392f1b..cb65cf67dfa2 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -54,7 +54,7 @@ config DEBUG_WX
>  # n, but then RMK will have to kill you ;).
>  config FRAME_POINTER
>         bool
> -       depends on !THUMB2_KERNEL
> +       depends on !THUMB2_KERNEL && CC_IS_GCC
>         default y if !ARM_UNWIND || FUNCTION_GRAPH_TRACER
>         help
>           If you say N here, the resulting kernel will be slightly smaller and

I suspect we actually need a bit more complexity here, as we have a couple
of options that do something like:

       select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390
&& !MICROBLAZE && !ARC && !X86

This means that in configurations without ARM_UNWIND, we still
fail to build with clang. Maybe something like x86 would work, this currently
has

choice
        prompt "Choose kernel unwinder"
        default UNWINDER_ORC if X86_64
        default UNWINDER_FRAME_POINTER if X86_32

config UNWINDER_ORC
        bool "ORC unwinder"
        depends on X86_64
        select STACK_VALIDATION

config UNWINDER_FRAME_POINTER
        bool "Frame pointer unwinder"
        select FRAME_POINTER

config UNWINDER_GUESS
        bool "Guess unwinder"
        depends on EXPERT
        depends on !STACKDEPOT

endchoice

so we always get some form of unwinding, but have different levels of
functionality in them. Implementing ORC on ARM might be nice, but
that's a lot of work, so I'm not expecting you to do that.

The simplest approach would be to always force ARM_UNWIND=y
when not building with gcc:

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 43d598c9b1f9..b390ac99ba20 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -60,7 +60,7 @@ config FRAME_POINTER
          reported is severely limited.

 config ARM_UNWIND
-       bool "Enable stack unwinding support (EXPERIMENTAL)"
+       bool "Enable stack unwinding support (EXPERIMENTAL)" if CC_IS_GCC
        depends on AEABI
        default y
        help

      Arnd

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-13 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-11  9:52 [PATCH] ARM: require GCC for FRAME_POINTER Stefan Agner
2018-08-13 21:12 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).