forked from OSchip/llvm-project
[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 llvm-svn: 334575
This commit is contained in:
parent
5c268f078d
commit
7252e2a8bd
|
@ -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_libraries name)
|
|||
|
||||
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})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue