[compiler-rt] r334575 - [XRay] Set an explicit dependency on libc++ when needed
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 13 00:08:29 PDT 2018
Author: phosek
Date: Wed Jun 13 00:08:28 2018
New Revision: 334575
URL: http://llvm.org/viewvc/llvm-project?rev=334575&view=rev
Log:
[XRay] Set an explicit dependency on libc++ when needed
When XRay is being built as part of the just built compiler together
with libc++ as part of the runtimes build, we need an explicit
dependency from XRay to libc++ to make sure that the library is
available by the time we start building XRay.
Differential Revision: https://reviews.llvm.org/D48113
Modified:
compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
compiler-rt/trunk/lib/xray/CMakeLists.txt
Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=334575&r1=334574&r2=334575&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Wed Jun 13 00:08:28 2018
@@ -31,9 +31,10 @@ endfunction()
# ARCHS <architectures>
# SOURCES <source files>
# CFLAGS <compile flags>
-# DEFS <compile definitions>)
+# DEFS <compile definitions>
+# DEPS <dependencies>)
function(add_compiler_rt_object_libraries name)
- cmake_parse_arguments(LIB "" "" "OS;ARCHS;SOURCES;CFLAGS;DEFS" ${ARGN})
+ cmake_parse_arguments(LIB "" "" "OS;ARCHS;SOURCES;CFLAGS;DEFS;DEPS" ${ARGN})
set(libnames)
if(APPLE)
foreach(os ${LIB_OS})
@@ -56,6 +57,9 @@ function(add_compiler_rt_object_librarie
foreach(libname ${libnames})
add_library(${libname} OBJECT ${LIB_SOURCES})
+ if(LIB_DEPS)
+ add_dependencies(${libname} ${LIB_DEPS})
+ endif()
# Strip out -msse3 if this isn't macOS.
set(target_flags ${LIB_CFLAGS})
Modified: compiler-rt/trunk/lib/xray/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/CMakeLists.txt?rev=334575&r1=334574&r2=334575&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/xray/CMakeLists.txt Wed Jun 13 00:08:28 2018
@@ -81,6 +81,10 @@ set(XRAY_COMMON_RUNTIME_OBJECT_LIBS
RTSanitizerCommon
RTSanitizerCommonLibc)
+if (CLANG_DEFAULT_CXX_STDLIB STREQUAL "libc++" AND (TARGET cxx OR HAVE_LIBCXX))
+ set(XRAY_DEPS cxx)
+endif()
+
if (APPLE)
set(XRAY_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
add_asm_sources(XRAY_ASM_SOURCES xray_trampoline_x86_64.S)
@@ -93,25 +97,29 @@ if (APPLE)
ARCHS ${XRAY_SUPPORTED_ARCH}
SOURCES ${x86_64_SOURCES}
CFLAGS ${XRAY_CFLAGS}
- DEFS ${XRAY_COMMON_DEFINITIONS})
+ DEFS ${XRAY_COMMON_DEFINITIONS}
+ DEPS ${XRAY_DEPS})
add_compiler_rt_object_libraries(RTXrayFDR
OS ${XRAY_SUPPORTED_OS}
ARCHS ${XRAY_SUPPORTED_ARCH}
SOURCES ${XRAY_FDR_MODE_SOURCES}
CFLAGS ${XRAY_CFLAGS}
- DEFS ${XRAY_COMMON_DEFINITIONS})
+ DEFS ${XRAY_COMMON_DEFINITIONS}
+ DEPS ${XRAY_DEPS})
add_compiler_rt_object_libraries(RTXrayBASIC
OS ${XRAY_SUPPORTED_OS}
ARCHS ${XRAY_SUPPORTED_ARCH}
SOURCES ${XRAY_BASIC_MODE_SOURCES}
CFLAGS ${XRAY_CFLAGS}
- DEFS ${XRAY_COMMON_DEFINITIONS})
+ DEFS ${XRAY_COMMON_DEFINITIONS}
+ DEPS ${XRAY_DEPS})
add_compiler_rt_object_libraries(RTXrayPROFILING
OS ${XRAY_SUPPORTED_OS}
ARCHS ${XRAY_SUPPORTED_ARCH}
SOURCES ${XRAY_PROFILING_MODE_SOURCES}
CFLAGS ${XRAY_CFLAGS}
- DEFS ${XRAY_COMMON_DEFINITIONS})
+ DEFS ${XRAY_COMMON_DEFINITIONS}
+ DEPS ${XRAY_DEPS})
# We only support running on osx for now.
add_compiler_rt_runtime(clang_rt.xray
@@ -164,19 +172,23 @@ else() # not Apple
add_compiler_rt_object_libraries(RTXray
ARCHS ${arch}
SOURCES ${XRAY_SOURCES} ${${arch}_SOURCES} CFLAGS ${XRAY_CFLAGS}
- DEFS ${XRAY_COMMON_DEFINITIONS})
+ DEFS ${XRAY_COMMON_DEFINITIONS}
+ DEPS ${XRAY_DEPS})
add_compiler_rt_object_libraries(RTXrayFDR
ARCHS ${arch}
SOURCES ${XRAY_FDR_MODE_SOURCES} CFLAGS ${XRAY_CFLAGS}
- DEFS ${XRAY_COMMON_DEFINITIONS})
+ DEFS ${XRAY_COMMON_DEFINITIONS}
+ DEPS ${XRAY_DEPS})
add_compiler_rt_object_libraries(RTXrayBASIC
ARCHS ${arch}
SOURCES ${XRAY_BASIC_MODE_SOURCES} CFLAGS ${XRAY_CFLAGS}
- DEFS ${XRAY_COMMON_DEFINITIONS})
+ DEFS ${XRAY_COMMON_DEFINITIONS}
+ DEPS ${XRAY_DEPS})
add_compiler_rt_object_libraries(RTXrayPROFILING
ARCHS ${arch}
SOURCES ${XRAY_PROFILING_MODE_SOURCES} CFLAGS ${XRAY_CFLAGS}
- DEFS ${XRAY_COMMON_DEFINITIONS})
+ DEFS ${XRAY_COMMON_DEFINITIONS}
+ DEPS ${XRAY_DEPS})
# Common XRay archive for instrumented binaries.
add_compiler_rt_runtime(clang_rt.xray
More information about the llvm-commits
mailing list