[dragonegg RFC/PATCH] Add low-level support for LLVM instrumentation passes

Peter Collingbourne peter at pcc.me.uk
Tue Jun 25 16:40:14 PDT 2013


On Wed, Apr 24, 2013 at 07:17:06PM -0700, Peter Collingbourne wrote:
> Hi,
> 
> This patch implements the low level functionality required to be
> able to use LLVM's instrumentation passes in DragonEgg.  For example,
> to instrument a TU using ThreadSanitizer, the following flag can be
> used: -fplugin-arg-dragonegg-llvm-option=-tsan
> 
> To get things working at a high level, the appropriate runtime
> libraries must be linked.  For example, TSan executables must be
> linked with libclang_rt.tsan-x86_64.a.  To make things work for
> myself, I've been hacking up spec files which emulate the Clang
> driver's sanitizer functionality.  For example, here's one for TSan:
> 
> ------------------------------------------------------------------------
> *cc1_options:
> + %{!nostdlib:-fplugin-arg-dragonegg-llvm-option=-tsan} %{!fPIC:%{!fPIE:-fPIE}}
> 
> *mflib:
> + %{!shared:%{!nostdlib:-whole-archive /path/to/llvm-build/lib/clang/3.3/lib/linux/libclang_rt.tsan-x86_64.a -no-whole-archive -lpthread -ldl -export-dynamic} %{!pie:%{!r:-pie}}}
> 
> *endfile:
> %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}    %{mpc32:crtprec32.o%s}    %{mpc64:crtprec64.o%s}    %{mpc80:crtprec80.o%s}    crtendS.o%s crtn.o%s
> 
> *startfile:
> %{!shared: %{pg|p|profile:gcrt1.o%s;:Scrt1.o%s}}    crti.o%s %{static:crtbeginT.o%s;:crtbeginS.o%s}
> ------------------------------------------------------------------------
> 
> I wanted to send this patch out to open up a discussion on the best
> way to support instrumentation in DragonEgg.  I don't think there's
> any way around using spec files, for example.  Perhaps we could
> have a set of .spec.in files, one for each sanitizer, which have the
> right paths substituted in at compile time.  (I asked a GCC developer
> whether it would be possible to support custom flags in a spec file,
> and his answer was "no".)

Ping.

Thanks,
-- 
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-instrumentation-stuff.patch
Type: text/x-diff
Size: 2497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130625/506cfc1f/attachment.patch>


More information about the llvm-commits mailing list