LFCS: Building the kernel with Clang
LFCS: Building the kernel with Clang
Posted May 5, 2011 2:28 UTC (Thu) by nevets (subscriber, #11875)Parent article: LFCS: Building the kernel with Clang
Here's a heads up on -pg -mfentry. The -mfentry on top of -pg uses a different mechanism other than mcount. It adds a call to __fentry__ instead of mcount, and uses this at the beginning of the function:
000000000000009e <atomic_long_add>:
9e: e8 00 00 00 00 callq a3 <atomic_long_add+0x5>
9f: R_X86_64_PC32 __fentry__-0x4
a3: 55 push %rbp
a4: 48 89 e5 mov %rsp,%rbp
Instead of:
00000000000000c4 <atomic_long_add>:
c4: 55 push %rbp
c5: 48 89 e5 mov %rsp,%rbp
c8: e8 00 00 00 00 callq cd <atomic_long_add+0x9>
c9: R_X86_64_PC32 mcount-0x4
cd: f0 48 01 3e lock add %rdi,(%rsi)
It is currently only supported in gcc 4.6.0 and higher on x86, and not on the other platforms (that I know of). I will be converting Ftrace to use this when available which will also add a lot more features to function tracing.
This is just forward looking, but if LLVM is to be a competitor of gcc, it will definitely need to support this.