dtrace -G vs. -flto
Mark Johnston
markj at FreeBSD.org
Tue Nov 28 01:50:23 UTC 2017
On Tue, Nov 28, 2017 at 01:34:00AM +0100, Jan Beich wrote:
> I'd like to build www/firefox with both DTrace and LTO support. Both
> Clang and GCC emit code that dtrace(1) doesn't understand.
Unfortunately, both gcc and clang's LTO implementations are completely
incompatible with the way that dtrace -G works. clang -flto produces
LLVM bitcode files, and gcc -flto produces ELF files with custom
sections. dtrace -G works by looking for relocations against symbols
named __dtrace_probe_*, and recording and overwriting the relocation
address, but the object files generated when using -flto are really only
meant for consumption by the static linker.
I think it might be possible to implement USDT for clang using LLVM's
patchpoint instrinsic, but this would still require some support in the
compiler. Anyway, I don't think it'll be possible to reconcile -flto
and dtrace -G without substantial work.
More information about the freebsd-toolchain
mailing list