-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt] Remove redundant COMPILER_RT_HAS_*SAN checks #98240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[compiler-rt] Remove redundant COMPILER_RT_HAS_*SAN checks #98240
Conversation
Created using spr 1.3.4
@llvm/pr-subscribers-xray @llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) ChangesThey are checked in the parent CMakeLists in There are non-redundant checks when a sanitizer checks Patch is 31.63 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/98240.diff 14 Files Affected:
diff --git a/compiler-rt/lib/CMakeLists.txt b/compiler-rt/lib/CMakeLists.txt
index f9e96563b8809..73a2ee46291ee 100644
--- a/compiler-rt/lib/CMakeLists.txt
+++ b/compiler-rt/lib/CMakeLists.txt
@@ -47,11 +47,11 @@ if(COMPILER_RT_BUILD_SANITIZERS)
endforeach()
endif()
-if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
+if(COMPILER_RT_BUILD_PROFILE)
compiler_rt_build_runtime(profile)
endif()
-if(COMPILER_RT_BUILD_CTX_PROFILE AND COMPILER_RT_HAS_CTX_PROFILE)
+if(COMPILER_RT_BUILD_CTX_PROFILE)
compiler_rt_build_runtime(ctx_profile)
endif()
diff --git a/compiler-rt/lib/gwp_asan/CMakeLists.txt b/compiler-rt/lib/gwp_asan/CMakeLists.txt
index bb5b2902f99db..fdb6a95fe1404 100644
--- a/compiler-rt/lib/gwp_asan/CMakeLists.txt
+++ b/compiler-rt/lib/gwp_asan/CMakeLists.txt
@@ -65,48 +65,46 @@ set(GWP_ASAN_SEGV_HANDLER_HEADERS
set(GWP_ASAN_OPTIONS_PARSER_CFLAGS
${GWP_ASAN_CFLAGS})
-if (COMPILER_RT_HAS_GWP_ASAN)
- foreach(arch ${GWP_ASAN_SUPPORTED_ARCH})
- add_compiler_rt_runtime(
- clang_rt.gwp_asan
- STATIC
- ARCHS ${arch}
- SOURCES ${GWP_ASAN_SOURCES}
- ADDITIONAL_HEADERS ${GWP_ASAN_HEADERS}
- CFLAGS ${GWP_ASAN_CFLAGS}
- PARENT_TARGET gwp_asan
- )
- endforeach()
+foreach(arch ${GWP_ASAN_SUPPORTED_ARCH})
+ add_compiler_rt_runtime(
+ clang_rt.gwp_asan
+ STATIC
+ ARCHS ${arch}
+ SOURCES ${GWP_ASAN_SOURCES}
+ ADDITIONAL_HEADERS ${GWP_ASAN_HEADERS}
+ CFLAGS ${GWP_ASAN_CFLAGS}
+ PARENT_TARGET gwp_asan
+ )
+endforeach()
- add_compiler_rt_object_libraries(RTGwpAsan
- ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
- SOURCES ${GWP_ASAN_SOURCES}
- ADDITIONAL_HEADERS ${GWP_ASAN_HEADERS}
- CFLAGS ${GWP_ASAN_CFLAGS})
+add_compiler_rt_object_libraries(RTGwpAsan
+ ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
+ SOURCES ${GWP_ASAN_SOURCES}
+ ADDITIONAL_HEADERS ${GWP_ASAN_HEADERS}
+ CFLAGS ${GWP_ASAN_CFLAGS})
- add_compiler_rt_object_libraries(RTGwpAsanOptionsParser
- ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
- SOURCES ${GWP_ASAN_OPTIONS_PARSER_SOURCES}
- ADDITIONAL_HEADERS ${GWP_ASAN_OPTIONS_PARSER_HEADERS}
- CFLAGS ${GWP_ASAN_OPTIONS_PARSER_CFLAGS})
+add_compiler_rt_object_libraries(RTGwpAsanOptionsParser
+ ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
+ SOURCES ${GWP_ASAN_OPTIONS_PARSER_SOURCES}
+ ADDITIONAL_HEADERS ${GWP_ASAN_OPTIONS_PARSER_HEADERS}
+ CFLAGS ${GWP_ASAN_OPTIONS_PARSER_CFLAGS})
- # As above, build the pre-implemented optional backtrace support libraries.
- add_compiler_rt_object_libraries(RTGwpAsanBacktraceLibc
- ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
- SOURCES optional/backtrace_linux_libc.cpp
- ADDITIONAL_HEADERS ${GWP_ASAN_BACKTRACE_HEADERS}
- CFLAGS ${GWP_ASAN_CFLAGS})
- add_compiler_rt_object_libraries(RTGwpAsanSegvHandler
- ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
- SOURCES optional/segv_handler_posix.cpp
- ADDITIONAL_HEADERS ${GWP_ASAN_SEGV_HANDLER_HEADERS}
- CFLAGS ${GWP_ASAN_CFLAGS})
- add_compiler_rt_object_libraries(RTGwpAsanBacktraceSanitizerCommon
- ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
- SOURCES optional/backtrace_sanitizer_common.cpp
- ADDITIONAL_HEADERS ${GWP_ASAN_BACKTRACE_HEADERS}
- CFLAGS ${GWP_ASAN_CFLAGS} ${SANITIZER_COMMON_CFLAGS})
-endif()
+# As above, build the pre-implemented optional backtrace support libraries.
+add_compiler_rt_object_libraries(RTGwpAsanBacktraceLibc
+ ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
+ SOURCES optional/backtrace_linux_libc.cpp
+ ADDITIONAL_HEADERS ${GWP_ASAN_BACKTRACE_HEADERS}
+ CFLAGS ${GWP_ASAN_CFLAGS})
+add_compiler_rt_object_libraries(RTGwpAsanSegvHandler
+ ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
+ SOURCES optional/segv_handler_posix.cpp
+ ADDITIONAL_HEADERS ${GWP_ASAN_SEGV_HANDLER_HEADERS}
+ CFLAGS ${GWP_ASAN_CFLAGS})
+add_compiler_rt_object_libraries(RTGwpAsanBacktraceSanitizerCommon
+ ARCHS ${GWP_ASAN_SUPPORTED_ARCH}
+ SOURCES optional/backtrace_sanitizer_common.cpp
+ ADDITIONAL_HEADERS ${GWP_ASAN_BACKTRACE_HEADERS}
+ CFLAGS ${GWP_ASAN_CFLAGS} ${SANITIZER_COMMON_CFLAGS})
if(COMPILER_RT_INCLUDE_TESTS)
add_subdirectory(tests)
diff --git a/compiler-rt/lib/lsan/CMakeLists.txt b/compiler-rt/lib/lsan/CMakeLists.txt
index 8e9861cd6b7c0..c7bb6449982c2 100644
--- a/compiler-rt/lib/lsan/CMakeLists.txt
+++ b/compiler-rt/lib/lsan/CMakeLists.txt
@@ -43,46 +43,44 @@ add_compiler_rt_object_libraries(RTLSanCommon
ADDITIONAL_HEADERS ${LSAN_HEADERS}
CFLAGS ${LSAN_CFLAGS})
-if(COMPILER_RT_HAS_LSAN)
- add_compiler_rt_component(lsan)
- if(APPLE)
- set(LSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
+add_compiler_rt_component(lsan)
+if(APPLE)
+ set(LSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
- add_weak_symbols("lsan" WEAK_SYMBOL_LINK_FLAGS)
- add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
+ add_weak_symbols("lsan" WEAK_SYMBOL_LINK_FLAGS)
+ add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
+ add_compiler_rt_runtime(clang_rt.lsan
+ SHARED
+ OS ${LSAN_SUPPORTED_OS}
+ ARCHS ${LSAN_SUPPORTED_ARCH}
+ SOURCES ${LSAN_SOURCES}
+ ADDITIONAL_HEADERS ${LSAN_HEADERS}
+ OBJECT_LIBS RTLSanCommon
+ RTInterception
+ RTSanitizerCommon
+ RTSanitizerCommonLibc
+ RTSanitizerCommonCoverage
+ RTSanitizerCommonSymbolizer
+ CFLAGS ${LSAN_CFLAGS}
+ LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
+ LINK_LIBS ${LSAN_LINK_LIBS}
+ PARENT_TARGET lsan)
+else()
+ foreach(arch ${LSAN_SUPPORTED_ARCH})
add_compiler_rt_runtime(clang_rt.lsan
- SHARED
- OS ${LSAN_SUPPORTED_OS}
- ARCHS ${LSAN_SUPPORTED_ARCH}
+ STATIC
+ ARCHS ${arch}
SOURCES ${LSAN_SOURCES}
+ $<TARGET_OBJECTS:RTInterception.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.${arch}>
+ $<TARGET_OBJECTS:RTLSanCommon.${arch}>
ADDITIONAL_HEADERS ${LSAN_HEADERS}
- OBJECT_LIBS RTLSanCommon
- RTInterception
- RTSanitizerCommon
- RTSanitizerCommonLibc
- RTSanitizerCommonCoverage
- RTSanitizerCommonSymbolizer
CFLAGS ${LSAN_CFLAGS}
- LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
- LINK_LIBS ${LSAN_LINK_LIBS}
PARENT_TARGET lsan)
- else()
- foreach(arch ${LSAN_SUPPORTED_ARCH})
- add_compiler_rt_runtime(clang_rt.lsan
- STATIC
- ARCHS ${arch}
- SOURCES ${LSAN_SOURCES}
- $<TARGET_OBJECTS:RTInterception.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.${arch}>
- $<TARGET_OBJECTS:RTLSanCommon.${arch}>
- ADDITIONAL_HEADERS ${LSAN_HEADERS}
- CFLAGS ${LSAN_CFLAGS}
- PARENT_TARGET lsan)
- endforeach()
- endif()
+ endforeach()
endif()
diff --git a/compiler-rt/lib/nsan/CMakeLists.txt b/compiler-rt/lib/nsan/CMakeLists.txt
index 36c7b2b9dfada..aef9b651ab2ec 100644
--- a/compiler-rt/lib/nsan/CMakeLists.txt
+++ b/compiler-rt/lib/nsan/CMakeLists.txt
@@ -25,31 +25,29 @@ set(NSAN_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
set(NSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
-if (COMPILER_RT_HAS_NSAN)
- foreach(arch ${NSAN_SUPPORTED_ARCH})
- add_compiler_rt_runtime(
- clang_rt.nsan
- STATIC
- ARCHS ${arch}
- SOURCES ${NSAN_SOURCES}
- $<TARGET_OBJECTS:RTInterception.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
- $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
- $<TARGET_OBJECTS:RTUbsan.${arch}>
- ADDITIONAL_HEADERS ${NSAN_HEADERS}
- CFLAGS ${NSAN_CFLAGS}
- PARENT_TARGET nsan
- )
- endforeach()
-
- add_compiler_rt_object_libraries(RTNsan
- ARCHS ${NSAN_SUPPORTED_ARCH}
- SOURCES ${NSAN_SOURCES}
- ADDITIONAL_HEADERS ${NSAN_HEADERS}
- CFLAGS ${NSAN_CFLAGS})
-endif()
+foreach(arch ${NSAN_SUPPORTED_ARCH})
+ add_compiler_rt_runtime(
+ clang_rt.nsan
+ STATIC
+ ARCHS ${arch}
+ SOURCES ${NSAN_SOURCES}
+ $<TARGET_OBJECTS:RTInterception.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
+ $<TARGET_OBJECTS:RTUbsan.${arch}>
+ ADDITIONAL_HEADERS ${NSAN_HEADERS}
+ CFLAGS ${NSAN_CFLAGS}
+ PARENT_TARGET nsan
+ )
+endforeach()
+
+add_compiler_rt_object_libraries(RTNsan
+ ARCHS ${NSAN_SUPPORTED_ARCH}
+ SOURCES ${NSAN_SOURCES}
+ ADDITIONAL_HEADERS ${NSAN_HEADERS}
+ CFLAGS ${NSAN_CFLAGS})
if(COMPILER_RT_INCLUDE_TESTS)
add_subdirectory(tests)
diff --git a/compiler-rt/lib/scudo/standalone/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/CMakeLists.txt
index 6fb4e88de3155..8fc245eb2cf38 100644
--- a/compiler-rt/lib/scudo/standalone/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/standalone/CMakeLists.txt
@@ -195,60 +195,58 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH MATCHES "mips|mips64|mipsel|mips64el")
list(APPEND SCUDO_LINK_LIBS atomic)
endif()
-if(COMPILER_RT_HAS_SCUDO_STANDALONE)
- add_compiler_rt_object_libraries(RTScudoStandalone
- ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
- SOURCES ${SCUDO_SOURCES}
- ADDITIONAL_HEADERS ${SCUDO_HEADERS}
- CFLAGS ${SCUDO_CFLAGS}
- DEPS ${SCUDO_DEPS})
- add_compiler_rt_object_libraries(RTScudoStandaloneCWrappers
- ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
- SOURCES ${SCUDO_SOURCES_C_WRAPPERS}
- ADDITIONAL_HEADERS ${SCUDO_HEADERS}
- CFLAGS ${SCUDO_CFLAGS}
- DEPS ${SCUDO_DEPS})
- add_compiler_rt_object_libraries(RTScudoStandaloneCxxWrappers
- ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
- SOURCES ${SCUDO_SOURCES_CXX_WRAPPERS}
- ADDITIONAL_HEADERS ${SCUDO_HEADERS}
- CFLAGS ${SCUDO_CFLAGS}
- DEPS ${SCUDO_DEPS})
-
+add_compiler_rt_object_libraries(RTScudoStandalone
+ ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
+ SOURCES ${SCUDO_SOURCES}
+ ADDITIONAL_HEADERS ${SCUDO_HEADERS}
+ CFLAGS ${SCUDO_CFLAGS}
+ DEPS ${SCUDO_DEPS})
+add_compiler_rt_object_libraries(RTScudoStandaloneCWrappers
+ ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
+ SOURCES ${SCUDO_SOURCES_C_WRAPPERS}
+ ADDITIONAL_HEADERS ${SCUDO_HEADERS}
+ CFLAGS ${SCUDO_CFLAGS}
+ DEPS ${SCUDO_DEPS})
+add_compiler_rt_object_libraries(RTScudoStandaloneCxxWrappers
+ ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
+ SOURCES ${SCUDO_SOURCES_CXX_WRAPPERS}
+ ADDITIONAL_HEADERS ${SCUDO_HEADERS}
+ CFLAGS ${SCUDO_CFLAGS}
+ DEPS ${SCUDO_DEPS})
+
+add_compiler_rt_runtime(clang_rt.scudo_standalone
+ STATIC
+ ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
+ SOURCES ${SCUDO_SOURCES} ${SCUDO_SOURCES_C_WRAPPERS}
+ ADDITIONAL_HEADERS ${SCUDO_HEADERS}
+ CFLAGS ${SCUDO_CFLAGS}
+ DEPS ${SCUDO_DEPS}
+ OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
+ PARENT_TARGET scudo_standalone)
+add_compiler_rt_runtime(clang_rt.scudo_standalone_cxx
+ STATIC
+ ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
+ SOURCES ${SCUDO_SOURCES_CXX_WRAPPERS}
+ ADDITIONAL_HEADERS ${SCUDO_HEADERS}
+ CFLAGS ${SCUDO_CFLAGS}
+ DEPS ${SCUDO_DEPS}
+ PARENT_TARGET scudo_standalone)
+
+if(COMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED)
add_compiler_rt_runtime(clang_rt.scudo_standalone
- STATIC
+ SHARED
ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
- SOURCES ${SCUDO_SOURCES} ${SCUDO_SOURCES_C_WRAPPERS}
+ SOURCES ${SCUDO_SOURCES} ${SCUDO_SOURCES_C_WRAPPERS} ${SCUDO_SOURCES_CXX_WRAPPERS}
ADDITIONAL_HEADERS ${SCUDO_HEADERS}
CFLAGS ${SCUDO_CFLAGS}
DEPS ${SCUDO_DEPS}
OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
+ LINK_FLAGS ${SCUDO_LINK_FLAGS}
+ LINK_LIBS ${SCUDO_LINK_LIBS}
PARENT_TARGET scudo_standalone)
- add_compiler_rt_runtime(clang_rt.scudo_standalone_cxx
- STATIC
- ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
- SOURCES ${SCUDO_SOURCES_CXX_WRAPPERS}
- ADDITIONAL_HEADERS ${SCUDO_HEADERS}
- CFLAGS ${SCUDO_CFLAGS}
- DEPS ${SCUDO_DEPS}
- PARENT_TARGET scudo_standalone)
-
- if(COMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED)
- add_compiler_rt_runtime(clang_rt.scudo_standalone
- SHARED
- ARCHS ${SCUDO_STANDALONE_SUPPORTED_ARCH}
- SOURCES ${SCUDO_SOURCES} ${SCUDO_SOURCES_C_WRAPPERS} ${SCUDO_SOURCES_CXX_WRAPPERS}
- ADDITIONAL_HEADERS ${SCUDO_HEADERS}
- CFLAGS ${SCUDO_CFLAGS}
- DEPS ${SCUDO_DEPS}
- OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
- LINK_FLAGS ${SCUDO_LINK_FLAGS}
- LINK_LIBS ${SCUDO_LINK_LIBS}
- PARENT_TARGET scudo_standalone)
- endif()
+endif()
- add_subdirectory(benchmarks)
- if(COMPILER_RT_INCLUDE_TESTS)
- add_subdirectory(tests)
- endif()
+add_subdirectory(benchmarks)
+if(COMPILER_RT_INCLUDE_TESTS)
+ add_subdirectory(tests)
endif()
diff --git a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
index 1786756fa5ea6..672cdc0ba655e 100644
--- a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
@@ -66,27 +66,25 @@ macro(add_scudo_unittest testname)
RTGwpAsan RTGwpAsanBacktraceLibc RTGwpAsanSegvHandler)
endif()
- if(COMPILER_RT_HAS_SCUDO_STANDALONE)
- foreach(arch ${SCUDO_TEST_ARCH})
- # Additional runtime objects get added along RTScudoStandalone
- set(SCUDO_TEST_RTOBJECTS $<TARGET_OBJECTS:RTScudoStandalone.${arch}>)
- foreach(rtobject ${TEST_ADDITIONAL_RTOBJECTS})
- list(APPEND SCUDO_TEST_RTOBJECTS $<TARGET_OBJECTS:${rtobject}.${arch}>)
- endforeach()
- # Add the static runtime library made of all the runtime objects
- set(RUNTIME RT${testname}.${arch})
- add_library(${RUNTIME} STATIC ${SCUDO_TEST_RTOBJECTS})
- set(ScudoUnitTestsObjects)
- generate_compiler_rt_tests(ScudoUnitTestsObjects ScudoUnitTests
- "${testname}-${arch}-Test" ${arch}
- SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
- COMPILE_DEPS ${SCUDO_TEST_HEADERS}
- DEPS scudo_standalone
- RUNTIME ${RUNTIME}
- CFLAGS ${SCUDO_UNITTEST_CFLAGS}
- LINK_FLAGS ${SCUDO_UNITTEST_LINK_FLAGS})
+ foreach(arch ${SCUDO_TEST_ARCH})
+ # Additional runtime objects get added along RTScudoStandalone
+ set(SCUDO_TEST_RTOBJECTS $<TARGET_OBJECTS:RTScudoStandalone.${arch}>)
+ foreach(rtobject ${TEST_ADDITIONAL_RTOBJECTS})
+ list(APPEND SCUDO_TEST_RTOBJECTS $<TARGET_OBJECTS:${rtobject}.${arch}>)
endforeach()
- endif()
+ # Add the static runtime library made of all the runtime objects
+ set(RUNTIME RT${testname}.${arch})
+ add_library(${RUNTIME} STATIC ${SCUDO_TEST_RTOBJECTS})
+ set(ScudoUnitTestsObjects)
+ generate_compiler_rt_tests(ScudoUnitTestsObjects ScudoUnitTests
+ "${testname}-${arch}-Test" ${arch}
+ SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
+ COMPILE_DEPS ${SCUDO_TEST_HEADERS}
+ DEPS scudo_standalone
+ RUNTIME ${RUNTIME}
+ CFLAGS ${SCUDO_UNITTEST_CFLAGS}
+ LINK_FLAGS ${SCUDO_UNITTEST_LINK_FLAGS})
+ endforeach()
endmacro()
set(SCUDO_UNIT_TEST_SOURCES
diff --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt
index db0b33f1276ef..a1cfbe93b068d 100644
--- a/compiler-rt/lib/ubsan/CMakeLists.txt
+++ b/compiler-rt/lib/ubsan/CMakeLists.txt
@@ -92,47 +92,45 @@ if(APPLE)
ADDITIONAL_HEADERS ${UBSAN_HEADERS}
CFLAGS ${UBSAN_CXXFLAGS})
- if(COMPILER_RT_HAS_UBSAN)
- # Initializer of standalone UBSan runtime.
- add_compiler_rt_object_libraries(RTUbsan_standalone
- OS ${UBSAN_SUPPORTED_OS}
- ARCHS ${UBSAN_SUPPORTED_ARCH}
- SOURCES ${UBSAN_STANDALONE_SOURCES}
- ADDITIONAL_HEADERS ${UBSAN_HEADERS}
- CFLAGS ${UBSAN_STANDALONE_CFLAGS})
+ # Initializer of standalone UBSan runtime.
+ add_compiler_rt_object_libraries(RTUbsan_standalone
+ OS ${UBSAN_SUPPORTED_OS}
+ ARCHS ${UBSAN_SUPPORTED_ARCH}
+ SOURCES ${UBSAN_STANDALONE_SOURCES}
+ ADDITIONAL_HEADERS ${UBSAN_HEADERS}
+ CFLAGS ${UBSAN_STANDALONE_CFLAGS})
+
+ add_weak_symbols("ubsan" WEAK_SYMBOL_LINK_FLAGS)
+ add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
- add_weak_symbols("ubsan" WEAK_SYMBOL_LINK_FLAGS)
- add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
+ add_compiler_rt_runtime(clang_rt.ubsan
+ SHARED
+ OS ${UBSAN_SUPPORTED_OS}
+ ARCHS ${UBSAN_SUPPORTED_ARCH}
+ OBJECT_LIBS RTUbsan
+ RTUbsan_standalone
+ RTSanitizerCommon
+ RTSanitizerCommonLibc
+ RTSanitizerCommonCoverage
+ RTSanitizerCommonSymbolizer
+ RTInterception
+ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
+ PARENT_TARGET ubsan)
+ if (NOT APPLE)
add_compiler_rt_runtime(clang_rt.ubsan
- SHARED
+ STATIC
OS ${UBSAN_SUPPORTED_OS}
ARCHS ${UBSAN_SUPPORTED_ARCH}
OBJECT_LIBS RTUbsan
RTUbsan_standalone
- RTSanitizerCommon
- RTSanitizerCommonLibc
+ RTSanitizerCommonNoHooks
+ RTSanitizerCommonLibcNoHooks
RTSanitizerCommonCoverage
- RTSanitizerCommonSymbolizer
+ RTSanitizerCommonSymbolizerNoHooks
RTInterception
LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
PARENT_TARGET ubsan)
-
- if (NOT APPLE)
- add_compiler_rt_runtime(clang_rt.ubsan
- STATIC
- OS ${UBSAN_SUPPORTED_OS}
- ARCHS ${UBSAN_SUPPORTED_ARCH}
- OBJECT_LIBS RTUbsan
- RTUbsan_standalone
- RTSanitizerCommonNoHooks
- RTSanitizerCommonLibcNoHooks
- RTSanitizerCommonCoverage
- RTSanitizerCommonSymbolizerNoHooks
- RTInterception
- LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}
- PARENT_TARGET ubsan)
- endif()
endif()
else()
@@ -190,91 +188,89 @@ else()
DEFS ${UBSAN_COMMON_DEFINITIONS})
endif()
- if(COMPILER_RT_HAS_UBSAN)
- add_compiler_rt_object_libraries(RTUbsan_standalone
- ARCHS ${UBSAN_SUPPORTED_ARCH}
- SOURCES ${UBSAN_STANDALONE_SOURCES}
- ADDITIONAL_HEADERS ${UBSAN_HEADERS}
- CFLAGS ${UBSAN_STANDALONE_CFLAGS})
-
- # Standalone UBSan runtimes.
- add_compiler_rt_runtime(clang_rt.ubsan_standalone
- STATIC
+ add_compiler_rt_object_libraries(RTUbsan_standalone
+ ARCHS ${UBSAN_SUPPORTED_ARCH}
+ SOURCES ${UBSAN_STANDALONE_SOURCES}
+ ADDITIONAL_HEADERS ${UBSAN_HEADERS}
+ CFLAGS ${UBSAN_STANDALONE_CFLAGS})
+
+ # Standalone UBSan runtimes.
+ add_compiler_rt_runtime(clang_rt.ubsan_standalone
+ STATIC
+ ARCHS ${UBSAN_SUPPORTED_ARCH}
+ SOURCES
+ ubsan_init_standalone_preinit.cpp
+ ADDITIONAL_HEADERS ${UBSAN_HEADERS}
+ OBJECT_LIBS RTSanitizerCommon
+ RTSanitizerCommonLibc
+ RTSanitizerCommonCoverage
+ RTSanitizerCommonSymbolizer
+ RTSanitizerCommonSymbolizerInternal
+ RTUbsan
+ RTUbsan_standalone
+ RTInterception
+ CFLAGS ${UBSAN_CFLAGS}
+ PARENT_TARGET ubsan)
+
+ add_compiler_rt_runtime(clang_rt.ubsan_standalone_cxx
+ STATIC
+ ARCHS ${UBSAN_SUPPORTED_ARCH}
+ OBJECT_LIBS RTUbsan_cxx
+ CFLAGS ${UBSAN_CXXFLAGS}
+ PARENT_TARGET ubsan)
+
+ if (COMPILER_RT_HAS_VERSION_SCRIPT)
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "")
+ add_compiler_rt_object_libraries(RTUbsan_dynamic_version_script_dummy
ARCHS ${UBSAN_SUPPORTED_ARCH}
- SOURCES
- ubsan_init_standalone_preinit.cpp
- ADDITIONAL_HEADERS ${UBSAN_HEADERS}
- OBJECT_LIBS RTSanitizerCommon
+ SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
+ CFLAGS ${...
[truncated]
|
CC @cjappl |
They are checked in the parent CMakeLists in `compiler_rt_build_runtime` and `compiler_rt_test_runtime`. There are non-redundant checks when a sanitizer checks for the presense of another one. They should not be removed.
Undo lsan, ubsan from llvm#98240 and 388c55a There are parts which do not check COMPILER_RT_HAS_*.
They are checked in the parent CMakeLists in
compiler_rt_build_runtime
andcompiler_rt_test_runtime
.There are non-redundant checks when a sanitizer checks
for the presense of another one. They should not be removed.