forked from OSchip/llvm-project
[TSan] Enforce TSan runtime doesn't include system headers with --sysroot flag.
llvm-svn: 254966
This commit is contained in:
parent
b4398d8585
commit
d20a13023b
|
@ -29,6 +29,7 @@ check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INIT
|
|||
check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
|
||||
check_cxx_compiler_flag(-msse3 COMPILER_RT_HAS_MSSE3_FLAG)
|
||||
check_cxx_compiler_flag(-std=c99 COMPILER_RT_HAS_STD_C99_FLAG)
|
||||
check_cxx_compiler_flag(--sysroot=. COMPILER_RT_HAS_SYSROOT_FLAG)
|
||||
|
||||
if(NOT WIN32 AND NOT CYGWIN)
|
||||
# MinGW warns if -fvisibility-inlines-hidden is used.
|
||||
|
|
|
@ -21,7 +21,6 @@ append_list_if(SANITIZER_LIMIT_FRAME_SIZE -Wframe-larger-than=512
|
|||
TSAN_RTL_CFLAGS)
|
||||
append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
|
||||
TSAN_RTL_CFLAGS)
|
||||
# FIXME: Add support for --sysroot=. compile flag:
|
||||
|
||||
set(TSAN_SOURCES
|
||||
rtl/tsan_clock.cc
|
||||
|
@ -187,6 +186,18 @@ endif()
|
|||
|
||||
add_dependencies(compiler-rt tsan)
|
||||
|
||||
# Make sure that non-platform-specific files don't include any system headers.
|
||||
if(COMPILER_RT_HAS_SYSROOT_FLAG)
|
||||
file(GLOB _tsan_generic_sources rtl/tsan*)
|
||||
file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac*
|
||||
rtl/tsan*linux*)
|
||||
list(REMOVE_ITEM _tsan_generic_sources ${_tsan_platform_sources})
|
||||
message(STATUS "platform: ${_tsan_platform_sources}")
|
||||
message(STATUS "generic: ${_tsan_generic_sources}")
|
||||
set_source_files_properties(${_tsan_generic_sources}
|
||||
PROPERTIES COMPILE_FLAGS "--sysroot=.")
|
||||
endif()
|
||||
|
||||
# Build libcxx instrumented with TSan.
|
||||
if(COMPILER_RT_HAS_LIBCXX_SOURCES AND
|
||||
COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang")
|
||||
|
|
Loading…
Reference in New Issue