summaryrefslogtreecommitdiff
path: root/lib/xray/xray_init.cc
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-11-28 11:49:22 +0000
committerDean Michael Berris <dberris@google.com>2017-11-28 11:49:22 +0000
commit22f6aeecb2122630e4b27e7018c9fb47d17edda5 (patch)
tree65348c05663de849a391f71704c8071159f2c422 /lib/xray/xray_init.cc
parentdc94bef4e936c15e096cb2a65163dc3cda3bb34d (diff)
[XRay][compiler-rt][Darwin] Minimal XRay build support in Darwin
This change is the first in a series of changes to get the XRay runtime building on macOS. This first allows us to build the minimal parts of XRay to get us started on supporting macOS development. These include: - CMake changes to allow targeting x86_64 initially. - Allowing for building the initialisation routines without `.preinit_array` support. - Use __sanitizer::SleepForMillis() to work around the lack of clock_nanosleep on macOS. - Deprecate the xray_fdr_log_grace_period_us flag, and introduce the xray_fdr_log_grace_period_ms flag instead, to use milliseconds across platforms. Reviewers: kubamracek Subscribers: llvm-commits, krytarowski, nglevin, mgorny Differential Review: https://reviews.llvm.org/D39114 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/xray/xray_init.cc')
-rw-r--r--lib/xray/xray_init.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/xray/xray_init.cc b/lib/xray/xray_init.cc
index 07f692431..864e77944 100644
--- a/lib/xray/xray_init.cc
+++ b/lib/xray/xray_init.cc
@@ -88,7 +88,8 @@ void __xray_init() XRAY_NEVER_INSTRUMENT {
#endif
}
-#ifndef XRAY_NO_PREINIT
+// Only add the preinit array initialization if the sanitizers can.
+#if !defined(XRAY_NO_PREINIT) && SANITIZER_CAN_USE_PREINIT_ARRAY
__attribute__((section(".preinit_array"),
used)) void (*__local_xray_preinit)(void) = __xray_init;
#endif