summaryrefslogtreecommitdiff
path: root/lib/xray/xray_init.cc
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-11-10 05:50:13 +0000
committerDean Michael Berris <dberris@google.com>2017-11-10 05:50:13 +0000
commitac4508cf5b04a7e52c4f565b55f6787a9ea47bc0 (patch)
tree8964f9f48eafc3b98df645930e0aa66dcccdb23e /lib/xray/xray_init.cc
parent6b924b53feb27108a9b7a3f3705e58d5b3980756 (diff)
[XRay][darwin] Initial XRay in Darwin Support
Summary: This change implements the changes required in both clang and compiler-rt to allow building XRay-instrumented binaries in Darwin. For now we limit this to x86_64. We also start building the XRay runtime library in compiler-rt for osx. A caveat to this is that we don't have the tests set up and running yet, which we'll do in a set of follow-on changes. This patch uses the monorepo layout for the coordinated change across multiple projects. Reviewers: kubamracek Subscribers: mgorny, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D39114 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317875 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