summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-08-03 00:58:45 +0000
committerDean Michael Berris <dberris@google.com>2017-08-03 00:58:45 +0000
commit9f25f183953ef11dd7c2c02a1b73e7d10b598b7e (patch)
tree53a59b99e4cb059fbfc7b8349f1070b83d0f3262 /include
parent5dea2733b9b133262190ffec6f967e81d0e8b27b (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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/xray/xray_interface.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/xray/xray_interface.h b/include/xray/xray_interface.h
index 564613417..d08039a67 100644
--- a/include/xray/xray_interface.h
+++ b/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