[compiler-rt] [rtsan] Re-enable rtsan tests (PR #98219)
Chris Apple via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 14:15:41 PDT 2024
cjappl wrote:
I think adding this patch would disable on windows and fuchsia, and we can evaluate in the future to enable them:
```
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 1130f9f721df..6df15c6cec17 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -751,7 +751,8 @@ else()
set(COMPILER_RT_HAS_ASAN FALSE)
endif()
-if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH)
+# RTSan does not run on windows or fuschia for now
+if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH AND NOT OS_NAME MATCHES "Windows|Fuchsia")
set(COMPILER_RT_HAS_RTSAN TRUE)
else()
set(COMPILER_RT_HAS_RTSAN FALSE)
diff --git a/compiler-rt/lib/rtsan/CMakeLists.txt b/compiler-rt/lib/rtsan/CMakeLists.txt
index bd7358e86e59..3cc27a2a8338 100644
--- a/compiler-rt/lib/rtsan/CMakeLists.txt
+++ b/compiler-rt/lib/rtsan/CMakeLists.txt
@@ -25,66 +25,68 @@ set(RTSAN_LINK_LIBS
${COMPILER_RT_UNWINDER_LINK_LIBS}
${COMPILER_RT_CXX_LINK_LIBS})
-if(APPLE)
- add_compiler_rt_object_libraries(RTRtsan
- OS ${SANITIZER_COMMON_SUPPORTED_OS}
- ARCHS ${RTSAN_SUPPORTED_ARCH}
- SOURCES ${RTSAN_CXX_SOURCES}
- ADDITIONAL_HEADERS ${RTSAN_HEADERS}
- CFLAGS ${RTSAN_CFLAGS}
- DEPS ${RTSAN_DEPS})
-else()
- add_compiler_rt_object_libraries(RTRtsan
- ARCHS ${RTSAN_SUPPORTED_ARCH}
- SOURCES ${RTSAN_CXX_SOURCES}
- ADDITIONAL_HEADERS ${RTSAN_HEADERS}
- CFLAGS ${RTSAN_CFLAGS}
- DEPS ${RTSAN_DEPS})
- add_compiler_rt_object_libraries(RTRtsan_preinit
- ARCHS ${RTSAN_SUPPORTED_ARCH}
- SOURCES ${RTSAN_PREINIT_SOURCES}
- ADDITIONAL_HEADERS ${RTSAN_HEADERS}
- CFLAGS ${RTSAN_CFLAGS})
-endif()
+if (COMPILER_RT_HAS_RTSAN)
+ if(APPLE)
+ add_compiler_rt_object_libraries(RTRtsan
+ OS ${SANITIZER_COMMON_SUPPORTED_OS}
+ ARCHS ${RTSAN_SUPPORTED_ARCH}
+ SOURCES ${RTSAN_CXX_SOURCES}
+ ADDITIONAL_HEADERS ${RTSAN_HEADERS}
+ CFLAGS ${RTSAN_CFLAGS}
+ DEPS ${RTSAN_DEPS})
+ else()
+ add_compiler_rt_object_libraries(RTRtsan
+ ARCHS ${RTSAN_SUPPORTED_ARCH}
+ SOURCES ${RTSAN_CXX_SOURCES}
+ ADDITIONAL_HEADERS ${RTSAN_HEADERS}
+ CFLAGS ${RTSAN_CFLAGS}
+ DEPS ${RTSAN_DEPS})
+ add_compiler_rt_object_libraries(RTRtsan_preinit
+ ARCHS ${RTSAN_SUPPORTED_ARCH}
+ SOURCES ${RTSAN_PREINIT_SOURCES}
+ ADDITIONAL_HEADERS ${RTSAN_HEADERS}
+ CFLAGS ${RTSAN_CFLAGS})
+ endif()
-set(RTSAN_COMMON_RUNTIME_OBJECT_LIBS
- RTInterception
- RTSanitizerCommon
- RTSanitizerCommonLibc
- RTSanitizerCommonCoverage
- RTSanitizerCommonSymbolizer)
+ set(RTSAN_COMMON_RUNTIME_OBJECT_LIBS
+ RTInterception
+ RTSanitizerCommon
+ RTSanitizerCommonLibc
+ RTSanitizerCommonCoverage
+ RTSanitizerCommonSymbolizer)
-append_list_if(COMPILER_RT_HAS_LIBDL dl RTSAN_LINK_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBRT rt RTSAN_LINK_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBM m RTSAN_LINK_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread RTSAN_LINK_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBLOG log RTSAN_LINK_LIBS)
+ append_list_if(COMPILER_RT_HAS_LIBDL dl RTSAN_LINK_LIBS)
+ append_list_if(COMPILER_RT_HAS_LIBRT rt RTSAN_LINK_LIBS)
+ append_list_if(COMPILER_RT_HAS_LIBM m RTSAN_LINK_LIBS)
+ append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread RTSAN_LINK_LIBS)
+ append_list_if(COMPILER_RT_HAS_LIBLOG log RTSAN_LINK_LIBS)
-add_compiler_rt_component(rtsan)
+ add_compiler_rt_component(rtsan)
-if (APPLE)
- add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
- set(RTSAN_LINK_FLAGS ${RTSAN_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS})
+ if (APPLE)
+ add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
+ set(RTSAN_LINK_FLAGS ${RTSAN_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS})
- add_compiler_rt_runtime(clang_rt.rtsan
- SHARED
- OS ${SANITIZER_COMMON_SUPPORTED_OS}
- ARCHS ${RTSAN_SUPPORTED_ARCH}
- OBJECT_LIBS RTRtsan
- ${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
- LINK_FLAGS ${RTSAN_LINK_FLAGS}
- LINK_LIBS ${RTSAN_LINK_LIBS}
- PARENT_TARGET rtsan)
-else()
- add_compiler_rt_runtime(clang_rt.rtsan
- STATIC
- ARCHS ${RTSAN_SUPPORTED_ARCH}
- OBJECT_LIBS RTRtsan_preinit
- RTRtsan
- ${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
- LINK_FLAGS ${RTSAN_LINK_FLAGS}
- CFLAGS ${RTSAN_CFLAGS}
- PARENT_TARGET rtsan)
+ add_compiler_rt_runtime(clang_rt.rtsan
+ SHARED
+ OS ${SANITIZER_COMMON_SUPPORTED_OS}
+ ARCHS ${RTSAN_SUPPORTED_ARCH}
+ OBJECT_LIBS RTRtsan
+ ${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
+ LINK_FLAGS ${RTSAN_LINK_FLAGS}
+ LINK_LIBS ${RTSAN_LINK_LIBS}
+ PARENT_TARGET rtsan)
+ else()
+ add_compiler_rt_runtime(clang_rt.rtsan
+ STATIC
+ ARCHS ${RTSAN_SUPPORTED_ARCH}
+ OBJECT_LIBS RTRtsan_preinit
+ RTRtsan
+ ${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
+ LINK_FLAGS ${RTSAN_LINK_FLAGS}
+ CFLAGS ${RTSAN_CFLAGS}
+ PARENT_TARGET rtsan)
+ endif()
endif()
if(COMPILER_RT_INCLUDE_TESTS)
```
https://github.com/llvm/llvm-project/pull/98219
More information about the llvm-commits
mailing list