summaryrefslogtreecommitdiff
path: root/lib/xray/xray_flags.cc
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2016-11-16 01:01:13 +0000
committerDean Michael Berris <dberris@google.com>2016-11-16 01:01:13 +0000
commita1df33d42314dc8c52e3eb5254f0f216397e60fc (patch)
tree3170b1ed69ea95bca55af2ddfebef5da3fdf08a2 /lib/xray/xray_flags.cc
parentec301129e76d82fbdf59168f7478b343cff71294 (diff)
[XRay][compiler-rt] Disable XRay instrumentation of the XRay runtime.
Summary: Adds a CMake check for whether the compiler used to build the XRay library supports XRay-instrumentation. If the compiler we're using does support the `-fxray-instrument` flag (i.e. recently-built Clang), we define the XRAY_NEVER_INSTRUMENT macro that then makes sure that the XRay runtime functions never get XRay-instrumented. This prevents potential weirdness involved with building the XRay library with a Clang that supports XRay-instrumentation, and is attempting to XRay-instrument the build of compiler-rt. Reviewers: majnemer, rSerge, echristo Subscribers: mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D26597 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@287068 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/xray/xray_flags.cc')
-rw-r--r--lib/xray/xray_flags.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/xray/xray_flags.cc b/lib/xray/xray_flags.cc
index 6f829128c..338c2378b 100644
--- a/lib/xray/xray_flags.cc
+++ b/lib/xray/xray_flags.cc
@@ -16,6 +16,7 @@
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_libc.h"
+#include "xray_defs.h"
using namespace __sanitizer;
@@ -23,20 +24,20 @@ namespace __xray {
Flags xray_flags_dont_use_directly; // use via flags().
-void Flags::SetDefaults() {
+void Flags::SetDefaults() XRAY_NEVER_INSTRUMENT {
#define XRAY_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
#include "xray_flags.inc"
#undef XRAY_FLAG
}
-static void RegisterXRayFlags(FlagParser *P, Flags *F) {
+static void RegisterXRayFlags(FlagParser *P, Flags *F) XRAY_NEVER_INSTRUMENT {
#define XRAY_FLAG(Type, Name, DefaultValue, Description) \
RegisterFlag(P, #Name, Description, &F->Name);
#include "xray_flags.inc"
#undef XRAY_FLAG
}
-void InitializeFlags() {
+void InitializeFlags() XRAY_NEVER_INSTRUMENT {
SetCommonFlagsDefaults();
auto *F = flags();
F->SetDefaults();