forked from OSchip/llvm-project
Revert "[CMake] Provide options for toggling on and off various runtime libraries."
This reverts r255170. This change caused a bunch of bot failures and needs to be revised. llvm-svn: 255184
This commit is contained in:
parent
a584158a25
commit
5c64ddfa88
|
|
@ -36,16 +36,6 @@ macro(append_list_if condition value)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Appends values to list if it isn't already there
|
|
||||||
macro(append_list_unique list)
|
|
||||||
foreach(val ${ARGN})
|
|
||||||
list(FIND ${list} ${val} idx)
|
|
||||||
if(idx EQUAL -1)
|
|
||||||
list(APPEND ${list} ${val})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Appends value to all strings in ARGN, if the condition is true.
|
# Appends value to all strings in ARGN, if the condition is true.
|
||||||
macro(append_string_if condition value)
|
macro(append_string_if condition value)
|
||||||
if(${condition})
|
if(${condition})
|
||||||
|
|
@ -77,12 +67,3 @@ macro(list_union output input1 input2)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(check_list_contains outvar list input)
|
|
||||||
list(FIND ${list} ${input} idx)
|
|
||||||
if(idx GREATER -1)
|
|
||||||
set(${outvar} True)
|
|
||||||
else()
|
|
||||||
set(${outvar} False)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
|
||||||
|
|
@ -505,82 +505,78 @@ endif()
|
||||||
if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
|
if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
|
||||||
(OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR
|
(OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR
|
||||||
(OS_NAME MATCHES "Windows" AND MSVC)))
|
(OS_NAME MATCHES "Windows" AND MSVC)))
|
||||||
list(APPEND DEFAULT_RUNTIMES sanitizer_common)
|
set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
|
||||||
|
else()
|
||||||
|
set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT OS_NAME MATCHES "Windows" OR CMAKE_SIZEOF_VOID_P EQUAL 4)
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND
|
||||||
list(APPEND DEFAULT_RUNTIMES interception)
|
|
||||||
list(APPEND REQUIRES_COMMON interception)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (ASAN_SUPPORTED_ARCH AND
|
|
||||||
(NOT OS_NAME MATCHES "Windows" OR CMAKE_SIZEOF_VOID_P EQUAL 4))
|
(NOT OS_NAME MATCHES "Windows" OR CMAKE_SIZEOF_VOID_P EQUAL 4))
|
||||||
list(APPEND DEFAULT_RUNTIMES asan)
|
set(COMPILER_RT_HAS_INTERCEPTION TRUE)
|
||||||
list(APPEND REQUIRES_COMMON asan)
|
else()
|
||||||
|
set(COMPILER_RT_HAS_INTERCEPTION FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH AND
|
||||||
|
(NOT OS_NAME MATCHES "Windows" OR CMAKE_SIZEOF_VOID_P EQUAL 4))
|
||||||
|
set(COMPILER_RT_HAS_ASAN TRUE)
|
||||||
|
else()
|
||||||
|
set(COMPILER_RT_HAS_ASAN FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (OS_NAME MATCHES "Linux|FreeBSD|Windows")
|
if (OS_NAME MATCHES "Linux|FreeBSD|Windows")
|
||||||
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME On)
|
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
|
||||||
|
else()
|
||||||
|
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TODO: Add builtins support.
|
# TODO: Add builtins support.
|
||||||
|
|
||||||
if (DFSAN_SUPPORTED_ARCH AND
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
|
||||||
OS_NAME MATCHES "Linux")
|
OS_NAME MATCHES "Linux")
|
||||||
list(APPEND DEFAULT_RUNTIMES dfsan)
|
set(COMPILER_RT_HAS_DFSAN TRUE)
|
||||||
list(APPEND REQUIRES_COMMON dfsan)
|
else()
|
||||||
|
set(COMPILER_RT_HAS_DFSAN FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (LSAN_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux|FreeBSD")
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND
|
||||||
list(APPEND DEFAULT_RUNTIMES lsan)
|
OS_NAME MATCHES "Linux|FreeBSD")
|
||||||
list(APPEND REQUIRES_COMMON lsan)
|
set(COMPILER_RT_HAS_LSAN TRUE)
|
||||||
|
else()
|
||||||
|
set(COMPILER_RT_HAS_LSAN FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSAN_SUPPORTED_ARCH AND
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTED_ARCH AND
|
||||||
OS_NAME MATCHES "Linux")
|
OS_NAME MATCHES "Linux")
|
||||||
list(APPEND DEFAULT_RUNTIMES msan)
|
set(COMPILER_RT_HAS_MSAN TRUE)
|
||||||
list(APPEND REQUIRES_COMMON msan)
|
else()
|
||||||
|
set(COMPILER_RT_HAS_MSAN FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (PROFILE_SUPPORTED_ARCH AND
|
if (PROFILE_SUPPORTED_ARCH AND
|
||||||
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
||||||
list(APPEND DEFAULT_RUNTIMES profile)
|
set(COMPILER_RT_HAS_PROFILE TRUE)
|
||||||
|
else()
|
||||||
|
set(COMPILER_RT_HAS_PROFILE FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (TSAN_SUPPORTED_ARCH AND
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
|
||||||
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
||||||
list(APPEND DEFAULT_RUNTIMES tsan)
|
set(COMPILER_RT_HAS_TSAN TRUE)
|
||||||
list(APPEND REQUIRES_COMMON tsan)
|
else()
|
||||||
|
set(COMPILER_RT_HAS_TSAN FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UBSAN_SUPPORTED_ARCH AND
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
|
||||||
OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows")
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows")
|
||||||
list(APPEND DEFAULT_RUNTIMES ubsan)
|
set(COMPILER_RT_HAS_UBSAN TRUE)
|
||||||
list(APPEND REQUIRES_COMMON ubsan)
|
else()
|
||||||
|
set(COMPILER_RT_HAS_UBSAN FALSE)
|
||||||
endif()
|
endif()
|
||||||
list(APPEND DEFAULT_RUNTIMES cfi)
|
|
||||||
|
|
||||||
if (SAFESTACK_SUPPORTED_ARCH AND
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND SAFESTACK_SUPPORTED_ARCH AND
|
||||||
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
||||||
list(APPEND DEFAULT_RUNTIMES safestack)
|
set(COMPILER_RT_HAS_SAFESTACK TRUE)
|
||||||
list(APPEND REQUIRES_COMMON safestack)
|
else()
|
||||||
endif()
|
set(COMPILER_RT_HAS_SAFESTACK FALSE)
|
||||||
|
|
||||||
set(COMPILER_RT_RUNTIMES_TO_BUILD "all"
|
|
||||||
CACHE STRING "Semicolon-separated list of runtimes to build, or \"all\".")
|
|
||||||
|
|
||||||
if(COMPILER_RT_RUNTIMES_TO_BUILD STREQUAL "all")
|
|
||||||
set(COMPILER_RT_RUNTIMES_TO_BUILD ${DEFAULT_RUNTIMES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Several of the runtimes produce object libraries that are consumed by other
|
|
||||||
# runtimes (i.e. asan relies on ubsan). If you're building a library that relies
|
|
||||||
# on common bits we need to build this full set of libraries.
|
|
||||||
list_union(SHOULD_BUILD_COMMON REQUIRES_COMMON COMPILER_RT_RUNTIMES_TO_BUILD)
|
|
||||||
|
|
||||||
if(SHOULD_BUILD_COMMON)
|
|
||||||
append_list_unique(COMPILER_RT_RUNTIMES_TO_BUILD sanitizer_common)
|
|
||||||
append_list_unique(COMPILER_RT_RUNTIMES_TO_BUILD lsan)
|
|
||||||
append_list_unique(COMPILER_RT_RUNTIMES_TO_BUILD ubsan)
|
|
||||||
append_list_unique(COMPILER_RT_RUNTIMES_TO_BUILD interception)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,40 @@ if(COMPILER_RT_BUILD_BUILTINS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(COMPILER_RT_BUILD_SANITIZERS)
|
if(COMPILER_RT_BUILD_SANITIZERS)
|
||||||
message(STATUS "Adding runtimes...")
|
if(COMPILER_RT_HAS_INTERCEPTION)
|
||||||
foreach(runtime ${COMPILER_RT_RUNTIMES_TO_BUILD})
|
add_subdirectory(interception)
|
||||||
message(STATUS "Adding runtime: ${runtime}")
|
endif()
|
||||||
add_subdirectory(${runtime})
|
|
||||||
endforeach()
|
if(COMPILER_RT_HAS_SANITIZER_COMMON)
|
||||||
|
add_subdirectory(sanitizer_common)
|
||||||
|
add_subdirectory(lsan)
|
||||||
|
add_subdirectory(ubsan)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(cfi)
|
||||||
|
|
||||||
|
if(COMPILER_RT_HAS_ASAN)
|
||||||
|
add_subdirectory(asan)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(COMPILER_RT_HAS_DFSAN)
|
||||||
|
add_subdirectory(dfsan)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(COMPILER_RT_HAS_MSAN)
|
||||||
|
add_subdirectory(msan)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(COMPILER_RT_HAS_PROFILE)
|
||||||
|
add_subdirectory(profile)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(COMPILER_RT_HAS_TSAN)
|
||||||
|
add_subdirectory(tsan)
|
||||||
|
add_subdirectory(tsan/dd)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(COMPILER_RT_HAS_SAFESTACK)
|
||||||
|
add_subdirectory(safestack)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ add_compiler_rt_object_libraries(RTLSanCommon
|
||||||
SOURCES ${LSAN_COMMON_SOURCES}
|
SOURCES ${LSAN_COMMON_SOURCES}
|
||||||
CFLAGS ${LSAN_CFLAGS})
|
CFLAGS ${LSAN_CFLAGS})
|
||||||
|
|
||||||
check_list_contains(COMPILER_RT_HAS_LSAN COMPILER_RT_RUNTIMES_TO_BUILD lsan)
|
|
||||||
if(COMPILER_RT_HAS_LSAN)
|
if(COMPILER_RT_HAS_LSAN)
|
||||||
foreach(arch ${LSAN_SUPPORTED_ARCH})
|
foreach(arch ${LSAN_SUPPORTED_ARCH})
|
||||||
add_compiler_rt_runtime(clang_rt.lsan
|
add_compiler_rt_runtime(clang_rt.lsan
|
||||||
|
|
|
||||||
|
|
@ -213,5 +213,3 @@ endif()
|
||||||
if(COMPILER_RT_INCLUDE_TESTS)
|
if(COMPILER_RT_INCLUDE_TESTS)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(dd)
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
# Build for the undefined behavior sanitizer runtime support library.
|
# Build for the undefined behavior sanitizer runtime support library.
|
||||||
|
|
||||||
check_list_contains(COMPILER_RT_HAS_UBSAN COMPILER_RT_RUNTIMES_TO_BUILD ubsan)
|
|
||||||
|
|
||||||
set(UBSAN_SOURCES
|
set(UBSAN_SOURCES
|
||||||
ubsan_diag.cc
|
ubsan_diag.cc
|
||||||
ubsan_init.cc
|
ubsan_init.cc
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,37 @@ endif()
|
||||||
# Run sanitizer tests only if we're sure that clang would produce
|
# Run sanitizer tests only if we're sure that clang would produce
|
||||||
# working binaries.
|
# working binaries.
|
||||||
if(COMPILER_RT_CAN_EXECUTE_TESTS)
|
if(COMPILER_RT_CAN_EXECUTE_TESTS)
|
||||||
foreach(runtime ${COMPILER_RT_RUNTIMES_TO_BUILD})
|
if(COMPILER_RT_HAS_ASAN)
|
||||||
add_subdirectory(${runtime})
|
add_subdirectory(asan)
|
||||||
endforeach()
|
endif()
|
||||||
|
if(COMPILER_RT_HAS_DFSAN)
|
||||||
|
add_subdirectory(dfsan)
|
||||||
|
endif()
|
||||||
|
if(COMPILER_RT_HAS_LSAN)
|
||||||
|
add_subdirectory(lsan)
|
||||||
|
endif()
|
||||||
|
if(COMPILER_RT_HAS_MSAN)
|
||||||
|
add_subdirectory(msan)
|
||||||
|
endif()
|
||||||
|
if(COMPILER_RT_HAS_PROFILE)
|
||||||
|
add_subdirectory(profile)
|
||||||
|
endif()
|
||||||
|
if(COMPILER_RT_HAS_SANITIZER_COMMON)
|
||||||
|
add_subdirectory(sanitizer_common)
|
||||||
|
endif()
|
||||||
|
if(COMPILER_RT_HAS_TSAN)
|
||||||
|
add_subdirectory(tsan)
|
||||||
|
endif()
|
||||||
|
if(COMPILER_RT_HAS_UBSAN)
|
||||||
|
add_subdirectory(ubsan)
|
||||||
|
endif()
|
||||||
|
# CFI tests require diagnostic mode, which is implemented in UBSan.
|
||||||
|
if(COMPILER_RT_HAS_UBSAN)
|
||||||
|
add_subdirectory(cfi)
|
||||||
|
endif()
|
||||||
|
if(COMPILER_RT_HAS_SAFESTACK)
|
||||||
|
add_subdirectory(safestack)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(COMPILER_RT_STANDALONE_BUILD)
|
if(COMPILER_RT_STANDALONE_BUILD)
|
||||||
|
|
@ -51,4 +79,3 @@ if(COMPILER_RT_STANDALONE_BUILD)
|
||||||
${LLVM_LIT_TESTSUITES}
|
${LLVM_LIT_TESTSUITES}
|
||||||
DEPENDS ${LLVM_LIT_DEPENDS})
|
DEPENDS ${LLVM_LIT_DEPENDS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,3 @@
|
||||||
check_list_contains(HAS_UBSAN COMPILER_RT_RUNTIMES_TO_BUILD ubsan)
|
|
||||||
# CFI tests require diagnostic mode, which is implemented in UBSan.
|
|
||||||
if(NOT HAS_UBSAN)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
configure_lit_site_cfg(
|
configure_lit_site_cfg(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
# Placeholder to avoid special casing.
|
|
||||||
|
|
@ -20,10 +20,6 @@ if(APPLE)
|
||||||
darwin_filter_host_archs(UBSAN_SUPPORTED_ARCH UBSAN_TEST_ARCH)
|
darwin_filter_host_archs(UBSAN_SUPPORTED_ARCH UBSAN_TEST_ARCH)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_list_contains(HAS_ASAN COMPILER_RT_RUNTIMES_TO_BUILD asan)
|
|
||||||
check_list_contains(HAS_MSAN COMPILER_RT_RUNTIMES_TO_BUILD msan)
|
|
||||||
check_list_contains(HAS_TSAN COMPILER_RT_RUNTIMES_TO_BUILD tsan)
|
|
||||||
|
|
||||||
foreach(arch ${UBSAN_TEST_ARCH})
|
foreach(arch ${UBSAN_TEST_ARCH})
|
||||||
set(UBSAN_TEST_TARGET_ARCH ${arch})
|
set(UBSAN_TEST_TARGET_ARCH ${arch})
|
||||||
if(${arch} MATCHES "arm|aarch64")
|
if(${arch} MATCHES "arm|aarch64")
|
||||||
|
|
@ -35,17 +31,13 @@ foreach(arch ${UBSAN_TEST_ARCH})
|
||||||
endif()
|
endif()
|
||||||
add_ubsan_testsuite("Standalone" ubsan ${arch})
|
add_ubsan_testsuite("Standalone" ubsan ${arch})
|
||||||
|
|
||||||
check_list_contains(ASAN_HAS_ARCH ASAN_SUPPORTED_ARCH ${arch})
|
if(COMPILER_RT_HAS_ASAN AND ";${ASAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
|
||||||
check_list_contains(MSAN_HAS_ARCH MSAN_SUPPORTED_ARCH ${arch})
|
|
||||||
check_list_contains(TSAN_HAS_ARCH TSAN_SUPPORTED_ARCH ${arch})
|
|
||||||
|
|
||||||
if(HAS_ASAN AND ASAN_HAS_ARCH)
|
|
||||||
add_ubsan_testsuite("AddressSanitizer" asan ${arch})
|
add_ubsan_testsuite("AddressSanitizer" asan ${arch})
|
||||||
endif()
|
endif()
|
||||||
if(HAS_MSAN AND MSAN_HAS_ARCH)
|
if(COMPILER_RT_HAS_MSAN AND ";${MSAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
|
||||||
add_ubsan_testsuite("MemorySanitizer" msan ${arch})
|
add_ubsan_testsuite("MemorySanitizer" msan ${arch})
|
||||||
endif()
|
endif()
|
||||||
if(HAS_TSAN AND TSAN_HAS_ARCH)
|
if(COMPILER_RT_HAS_TSAN AND ";${TSAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
|
||||||
add_ubsan_testsuite("ThreadSanitizer" tsan ${arch})
|
add_ubsan_testsuite("ThreadSanitizer" tsan ${arch})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue