aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2018-09-24 05:28:01 +0000
committerDean Michael Berris <dberris@google.com>2018-09-24 05:28:01 +0000
commit11660ddaa868c650e21546b1761b5dc88e04f7ef (patch)
tree1b94722115bbb78a4144e56624a822a99d04ea6d /cmake/Modules
parent278a3aad4c33c0a69acbec3b952c58dae7ba4d5d (diff)
[XRay] Clean up XRay build configuration
Summary: This change spans both LLVM and compiler-rt, where we do the following: - Add XRay to the LLVMBuild system, to allow for distributing the XRay trace loading library along with the LLVM distributions. - Use `llvm-config` better in the compiler-rt XRay implementation, to depend on the potentially already-distributed LLVM XRay library. While this is tested with the standalone compiler-rt build, it does require that the LLVMXRay library (and LLVMSupport as well) are available during the build. In case the static libraries are available, the unit tests will build and work fine. We're still having issues with attempting to use a shared library version of the LLVMXRay library since the shared library might not be accessible from the standard shared library lookup paths. The larger change here is the inclusion of the LLVMXRay library in the distribution, which allows for building tools around the XRay traces and profiles that the XRay runtime already generates. Reviewers: echristo, beanz Subscribers: mgorny, hiraditya, mboerger, llvm-commits Differential Revision: https://reviews.llvm.org/D52349 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/CompilerRTUtils.cmake18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
index e2884e23e..d2cb48677 100644
--- a/cmake/Modules/CompilerRTUtils.cmake
+++ b/cmake/Modules/CompilerRTUtils.cmake
@@ -236,6 +236,24 @@ macro(load_llvm_config)
set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Paths to LLVM headers")
+ # Detect if we have the LLVMXRay and TestingSupport library installed and
+ # available from llvm-config.
+ execute_process(
+ COMMAND ${LLVM_CONFIG_PATH} "--ldflags" "--libs" "xray" "testingsupport"
+ RESULT_VARIABLE HAD_ERROR
+ OUTPUT_VARIABLE CONFIG_OUTPUT)
+ if (HAD_ERROR)
+ message(WARNING "llvm-config finding xray failed with status ${HAD_ERROR}")
+ set(COMPILER_RT_HAS_LLVMXRAY FALSE)
+ else()
+ string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
+ list(GET CONFIG_OUTPUT 0 LDFLAGS)
+ list(GET CONFIG_OUTPUT 1 LIBLIST)
+ set(LLVM_XRAY_LDFLAGS ${LDFLAGS} CACHE STRING "Linker flags for LLVMXRay library")
+ set(LLVM_XRAY_LIBLIST ${LIBLIST} CACHE STRING "Library list for LLVMXRay")
+ set(COMPILER_RT_HAS_LLVMXRAY TRUE)
+ endif()
+
# Make use of LLVM CMake modules.
# --cmakedir is supported since llvm r291218 (4.0 release)
execute_process(