[XRay][compiler-rt] Allow for building the XRay runtime without PREINIT initialization.
authorDean Michael Berris <dberris@google.com>
Thu, 3 Aug 2017 00:58:45 +0000 (00:58 +0000)
committerDean Michael Berris <dberris@google.com>
Thu, 3 Aug 2017 00:58:45 +0000 (00:58 +0000)
commit449fdf816e0b18ff75c2b4a9b3f9ce83063c57b6
tree2690a33b7caa02a9831d4a56b2666b6ac7ecb1a3
parent1efd2229f07069dac5fc2a5da97f5056021a42f7
[XRay][compiler-rt] Allow for building the XRay runtime without PREINIT initialization.

Summary:
Define a build-time configuration option for the XRay runtime to
determine whether the archive will add an entry to the `.preinit_array`
section of the binary. We also allow for initializing the XRay data
structures with an explicit call to __xray_init(). This allows us to
give users the capability to initialize the XRay data structures on
demand.

This can allow us to start porting XRay to platforms where
`.preinit_array` isn't a supported section. It also allows us to limit
the effects of XRay in the initialization sequence for applications that
are sensitive to this kind of interference (i.e. large binaries) or
those that want to package XRay control in libraries.

Future changes should allow us to build two different library archives
for the XRay runtime, and allow clang users to determine which version
to link.

Reviewers: dblaikie, kpw, pelikan

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D36080

llvm-svn: 309909
compiler-rt/CMakeLists.txt
compiler-rt/include/xray/xray_interface.h
compiler-rt/lib/xray/CMakeLists.txt
compiler-rt/lib/xray/xray_init.cc