[compiler-rt] r306431 - Revert "Only test sanitizers that are built when COMPILER_RT_SANITIZERS_TO_BUILD is used"

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 10:24:26 PDT 2017


Author: fjricci
Date: Tue Jun 27 10:24:26 2017
New Revision: 306431

URL: http://llvm.org/viewvc/llvm-project?rev=306431&view=rev
Log:
Revert "Only test sanitizers that are built when COMPILER_RT_SANITIZERS_TO_BUILD is used"

This breaks cfi testing in cases when the cfi runtime isn't built.

This reverts commit 1c6a7b07545f0c9ce68e8b226f5397694ce48af7.

Modified:
    compiler-rt/trunk/lib/CMakeLists.txt
    compiler-rt/trunk/test/CMakeLists.txt

Modified: compiler-rt/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/CMakeLists.txt?rev=306431&r1=306430&r2=306431&view=diff
==============================================================================
--- compiler-rt/trunk/lib/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/CMakeLists.txt Tue Jun 27 10:24:26 2017
@@ -28,6 +28,7 @@ function(compiler_rt_build_runtime runti
 endfunction()
 
 function(compiler_rt_build_sanitizer sanitizer)
+  string(TOUPPER ${sanitizer} sanitizer_uppercase)
   string(TOLOWER ${sanitizer} sanitizer_lowercase)
   list(FIND COMPILER_RT_SANITIZERS_TO_BUILD ${sanitizer_lowercase} result)
   if(NOT ${result} EQUAL -1)

Modified: compiler-rt/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/CMakeLists.txt?rev=306431&r1=306430&r2=306431&view=diff
==============================================================================
--- compiler-rt/trunk/test/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/CMakeLists.txt Tue Jun 27 10:24:26 2017
@@ -35,21 +35,6 @@ if(NOT ANDROID)
   endif()
 endif()
 
-function(compiler_rt_test_runtime runtime)
-  string(TOUPPER ${runtime} runtime_uppercase)
-  if(COMPILER_RT_HAS_${runtime_uppercase})
-    add_subdirectory(${runtime})
-  endif()
-endfunction()
-
-function(compiler_rt_test_sanitizer sanitizer)
-  string(TOLOWER ${sanitizer} sanitizer_lowercase)
-  list(FIND COMPILER_RT_SANITIZERS_TO_BUILD ${sanitizer_lowercase} result)
-  if(NOT ${result} EQUAL -1)
-    compiler_rt_test_runtime(${sanitizer})
-  endif()
-endfunction()
-
 # Run sanitizer tests only if we're sure that clang would produce
 # working binaries.
 if(COMPILER_RT_CAN_EXECUTE_TESTS)
@@ -57,25 +42,49 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS)
     add_subdirectory(builtins)
   endif()
   if(COMPILER_RT_BUILD_SANITIZERS)
-    compiler_rt_test_runtime(interception)
-
-    compiler_rt_test_runtime(lsan)
-    compiler_rt_test_runtime(ubsan)
-    compiler_rt_test_runtime(sanitizer_common)
-
-    compiler_rt_test_sanitizer(asan)
-    compiler_rt_test_sanitizer(dfsan)
-    compiler_rt_test_sanitizer(msan)
-    compiler_rt_test_sanitizer(tsan)
-    compiler_rt_test_sanitizer(safestack)
-    compiler_rt_test_sanitizer(cfi)
-    compiler_rt_test_sanitizer(esan)
-    compiler_rt_test_sanitizer(scudo)
-
-    compiler_rt_test_runtime(profile)
+    if(COMPILER_RT_HAS_ASAN)
+      add_subdirectory(asan)
+    endif()
+    if(COMPILER_RT_HAS_DFSAN)
+      add_subdirectory(dfsan)
+    endif()
+    if (COMPILER_RT_HAS_INTERCEPTION)
+      add_subdirectory(interception)
+    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()
+    if(COMPILER_RT_HAS_ESAN)
+      add_subdirectory(esan)
+    endif()
+    if(COMPILER_RT_HAS_SCUDO)
+      add_subdirectory(scudo)
+    endif()
   endif()
-  if(COMPILER_RT_BUILD_XRAY)
-    compiler_rt_test_runtime(xray)
+  if(COMPILER_RT_BUILD_XRAY AND COMPILER_RT_HAS_XRAY)
+    add_subdirectory(xray)
   endif()
 endif()
 




More information about the llvm-commits mailing list