Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Nov 2017 20:50:16 -0500
From:      Mark Johnston <markj@FreeBSD.org>
To:        Jan Beich <jbeich@FreeBSD.org>
Cc:        freebsd-dtrace@freebsd.org, freebsd-toolchain@freebsd.org
Subject:   Re: dtrace -G vs. -flto
Message-ID:  <20171128015016.GA89416@raichu>
In-Reply-To: <efoj-5jif-wny@FreeBSD.org>
References:  <efoj-5jif-wny@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171128015016.GA89416>