linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: stefan@agner.ch (Stefan Agner)
To: linux-arm-kernel@lists.infradead.org
Subject: Function Tracing with clang on ARM32
Date: Sat, 11 Aug 2018 14:29:24 +0200	[thread overview]
Message-ID: <35ae3d464c7b77a5fe86a732079e32bc@agner.ch> (raw)

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

             reply	other threads:[~2018-08-11 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-11 12:29 Stefan Agner [this message]
2018-08-24 21:20 ` Function Tracing with clang on ARM32 Matthias Kaehlcke
2018-08-26 19:22   ` Stefan Agner

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=35ae3d464c7b77a5fe86a732079e32bc@agner.ch \
    --to=stefan@agner.ch \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 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).