diff options
author | Dean Michael Berris <dberris@google.com> | 2017-08-03 00:58:45 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-08-03 00:58:45 +0000 |
commit | 8c0d0746613535cc4233cffbfbc2a075c9526fcc (patch) | |
tree | e1c344820000d838de8d7eb6083c733d762e7b7e /compiler-rt/include | |
parent | 581c1f207e89a3f2b94032e87943eefe495b6fb9 (diff) |
[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
Diffstat (limited to 'compiler-rt/include')
-rw-r--r-- | compiler-rt/include/xray/xray_interface.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler-rt/include/xray/xray_interface.h b/compiler-rt/include/xray/xray_interface.h index 56461341706..d08039a67fa 100644 --- a/compiler-rt/include/xray/xray_interface.h +++ b/compiler-rt/include/xray/xray_interface.h @@ -106,6 +106,14 @@ extern uintptr_t __xray_function_address(int32_t FuncId); /// encounter errors (when there are no instrumented functions, etc.). extern size_t __xray_max_function_id(); +/// Initialize the required XRay data structures. This is useful in cases where +/// users want to control precisely when the XRay instrumentation data +/// structures are initialized, for example when the XRay library is built with +/// the XRAY_NO_PREINIT preprocessor definition. +/// +/// Calling __xray_init() more than once is safe across multiple threads. +extern void __xray_init(); + } // end extern "C" #endif // XRAY_XRAY_INTERFACE_H |