linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Function Tracing with clang on ARM32
@ 2018-08-11 12:29 Stefan Agner
  2018-08-24 21:20 ` Matthias Kaehlcke
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2018-08-11 12:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I am currently looking into function tracing support when compiling an
ARM32 kernel with clang.

With v4.18-rc1 and:
CONFIG_FTRACE=y                                                         
                                                                   
CONFIG_FUNCTION_TRACER=y

Building fails:

  LD      vmlinux.o                                                     
                                                                  
  MODPOST vmlinux.o
kernel/softirq.o: In function `_local_bh_enable':
/home/ags/projects/toradex/imx/linux-vanilla-llvm/kernel/softirq.c:152:
undefined reference to `mcount'
kernel/softirq.o: In function `__local_bh_enable_ip':
/home/ags/projects/toradex/imx/linux-vanilla-llvm/kernel/softirq.c:159:
undefined reference to `mcount'
kernel/softirq.o: In function `do_softirq':
/home/ags/projects/toradex/imx/linux-vanilla-llvm/kernel/softirq.c:316:
undefined reference to `mcount'
kernel/softirq.o: In function `irq_enter':
/home/ags/projects/toradex/imx/linux-vanilla-llvm/kernel/softirq.c:337:
undefined reference to `mcount'
kernel/softirq.o: In function `irq_exit':
/home/ags/projects/toradex/imx/linux-vanilla-llvm/kernel/softirq.c:395:
undefined reference to `mcount'

It seems that clang/LLVM uses a different mcount interface. However,
there is an option to use the gcc compatible symbol __gnu_mcount_nc when
using -meabi gnu. So adding
CFLAGS_ABI     +=-meabi gnu

Builds the kernel successfully. However, the kernel crashes immediately
on boot. Even with earlyprintk enabled, I only get:

Uncompressing Linux... done, booting the kernel.

I poked a bit around in arch/arm/kernel/entry-ftrace.S. Not calling
__mcount in __gnu_mcount_nc produces a bootable kernel. Removing the
call into the ftrace logic by only using mcount_enter/exit in the
__mcount macro does not boot...

I guess the mcount ABI is slightly different in LLVM/clang still then?
Before I dive deeper, maybe anyone has an idea?

--
Stefan

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

end of thread, other threads:[~2018-08-26 19:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-11 12:29 Function Tracing with clang on ARM32 Stefan Agner
2018-08-24 21:20 ` Matthias Kaehlcke
2018-08-26 19:22   ` Stefan Agner

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