[compiler-rt] 4540d66 - [CMake] Track TSan's dependency on C++ headers
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 13:59:26 PDT 2020
Author: Petr Hosek
Date: 2020-10-06T13:58:35-07:00
New Revision: 4540d6624838af2b190dfb33802528eb4bfb3fb8
URL: https://github.com/llvm/llvm-project/commit/4540d6624838af2b190dfb33802528eb4bfb3fb8
DIFF: https://github.com/llvm/llvm-project/commit/4540d6624838af2b190dfb33802528eb4bfb3fb8.diff
LOG: [CMake] Track TSan's dependency on C++ headers
TSan relies on C++ headers, so when libc++ is being built as part of
the runtimes build, include an explicit dependency on cxx-headers which
is the same approach that's already used for other sanitizers.
Differential Revision: https://reviews.llvm.org/D88912
Added:
Modified:
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/lib/tsan/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index f2f0b5ecde59..90a946a0df7d 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -140,6 +140,7 @@ endmacro()
# CFLAGS <compile flags>
# LINK_FLAGS <linker flags>
# DEFS <compile definitions>
+# DEPS <dependencies>
# LINK_LIBS <linked libraries> (only for shared library)
# OBJECT_LIBS <object libraries to use as sources>
# PARENT_TARGET <convenience parent target>
@@ -152,7 +153,7 @@ function(add_compiler_rt_runtime name type)
cmake_parse_arguments(LIB
""
"PARENT_TARGET"
- "OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;LINK_LIBS;OBJECT_LIBS;ADDITIONAL_HEADERS"
+ "OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;DEPS;LINK_LIBS;OBJECT_LIBS;ADDITIONAL_HEADERS"
${ARGN})
set(libnames)
# Until we support this some other way, build compiler-rt runtime without LTO
@@ -329,6 +330,9 @@ function(add_compiler_rt_runtime name type)
RUNTIME DESTINATION ${install_dir_${libname}}
${COMPONENT_OPTION})
endif()
+ if(LIB_DEPS)
+ add_dependencies(${libname} ${LIB_DEPS})
+ endif()
set_target_properties(${libname} PROPERTIES
OUTPUT_NAME ${output_name_${libname}})
set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Runtime")
diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt
index c99b16d8aaa3..3c6731d79dc4 100644
--- a/compiler-rt/lib/tsan/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/CMakeLists.txt
@@ -25,6 +25,10 @@ append_list_if(SANITIZER_LIMIT_FRAME_SIZE -Wframe-larger-than=530
append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
TSAN_RTL_CFLAGS)
+if (TARGET cxx-headers OR HAVE_LIBCXX)
+ set(TSAN_DEPS cxx-headers)
+endif()
+
set(TSAN_SOURCES
rtl/tsan_clock.cpp
rtl/tsan_debugging.cpp
@@ -142,6 +146,7 @@ if(APPLE)
RTSanitizerCommonSymbolizer
RTUbsan
CFLAGS ${TSAN_RTL_CFLAGS}
+ DEPS ${TSAN_DEPS}
LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
LINK_LIBS ${TSAN_LINK_LIBS} objc
PARENT_TARGET tsan)
@@ -150,7 +155,8 @@ if(APPLE)
ARCHS ${TSAN_SUPPORTED_ARCH}
SOURCES ${TSAN_SOURCES} ${TSAN_CXX_SOURCES} ${TSAN_ASM_SOURCES}
ADDITIONAL_HEADERS ${TSAN_HEADERS}
- CFLAGS ${TSAN_RTL_CFLAGS})
+ CFLAGS ${TSAN_RTL_CFLAGS}
+ DEPS ${TSAN_DEPS})
# Build and check Go runtime.
set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
@@ -214,6 +220,7 @@ else()
$<TARGET_OBJECTS:RTUbsan.${arch}>
ADDITIONAL_HEADERS ${TSAN_HEADERS}
CFLAGS ${TSAN_RTL_CFLAGS}
+ DEPS ${TSAN_DEPS}
PARENT_TARGET tsan)
add_compiler_rt_runtime(clang_rt.tsan_cxx
STATIC
@@ -222,6 +229,7 @@ else()
$<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
ADDITIONAL_HEADERS ${TSAN_HEADERS}
CFLAGS ${TSAN_RTL_CFLAGS}
+ DEPS ${TSAN_DEPS}
PARENT_TARGET tsan)
list(APPEND TSAN_RUNTIME_LIBRARIES clang_rt.tsan-${arch}
clang_rt.tsan_cxx-${arch})
More information about the llvm-commits
mailing list