diff options
author | Dean Michael Berris <dberris@google.com> | 2016-11-16 01:01:13 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2016-11-16 01:01:13 +0000 |
commit | a1df33d42314dc8c52e3eb5254f0f216397e60fc (patch) | |
tree | 3170b1ed69ea95bca55af2ddfebef5da3fdf08a2 /lib/xray/CMakeLists.txt | |
parent | ec301129e76d82fbdf59168f7478b343cff71294 (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/CMakeLists.txt')
-rw-r--r-- | lib/xray/CMakeLists.txt | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/lib/xray/CMakeLists.txt b/lib/xray/CMakeLists.txt index 12d9b7a53..c9f5105eb 100644 --- a/lib/xray/CMakeLists.txt +++ b/lib/xray/CMakeLists.txt @@ -2,20 +2,20 @@ set(XRAY_SOURCES xray_init.cc - xray_interface.cc - xray_flags.cc + xray_interface.cc + xray_flags.cc xray_inmemory_log.cc ) set(x86_64_SOURCES - xray_x86_64.cc - xray_trampoline_x86_64.S - ${XRAY_SOURCES}) + xray_x86_64.cc + xray_trampoline_x86_64.S + ${XRAY_SOURCES}) set(arm_SOURCES - xray_arm.cc - xray_trampoline_arm.S - ${XRAY_SOURCES}) + xray_arm.cc + xray_trampoline_arm.S + ${XRAY_SOURCES}) set(armhf_SOURCES ${arm_SOURCES}) @@ -25,6 +25,8 @@ include_directories(../../include) set(XRAY_CFLAGS ${SANITIZER_COMMON_CFLAGS}) set(XRAY_COMMON_DEFINITIONS XRAY_HAS_EXCEPTIONS=1) +append_list_if( + COMPILER_RT_HAS_XRAY_COMPILER_FLAG XRAY_SUPPORTED=1 XRAY_COMMON_DEFINITIONS) add_compiler_rt_object_libraries(RTXray ARCHS ${XRAY_SUPPORTED_ARCH} @@ -34,18 +36,18 @@ add_compiler_rt_object_libraries(RTXray add_compiler_rt_component(xray) set(XRAY_COMMON_RUNTIME_OBJECT_LIBS - RTSanitizerCommon - RTSanitizerCommonLibc) + RTSanitizerCommon + RTSanitizerCommonLibc) foreach (arch ${XRAY_SUPPORTED_ARCH}) - if (CAN_TARGET_${arch}) - add_compiler_rt_runtime(clang_rt.xray - STATIC - ARCHS ${arch} - SOURCES ${${arch}_SOURCES} - CFLAGS ${XRAY_CFLAGS} - DEFS ${XRAY_COMMON_DEFINITIONS} - OBJECT_LIBS ${XRAY_COMMON_RUNTIME_OBJECT_LIBS} - PARENT_TARGET xray) - endif () + if (CAN_TARGET_${arch}) + add_compiler_rt_runtime(clang_rt.xray + STATIC + ARCHS ${arch} + SOURCES ${${arch}_SOURCES} + CFLAGS ${XRAY_CFLAGS} + DEFS ${XRAY_COMMON_DEFINITIONS} + OBJECT_LIBS ${XRAY_COMMON_RUNTIME_OBJECT_LIBS} + PARENT_TARGET xray) + endif () endforeach() |