[compiler-rt] 919ca9f - [compiler-rt] separate lsan, ubsan, stats configuration from SANITIZER_COMMON_SUPPORTED_OS

Emily Shi via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 19:16:26 PST 2021


Author: Emily Shi
Date: 2021-11-10T19:16:20-08:00
New Revision: 919ca9fc045f84b507bf80332c398a6fc3be1681

URL: https://github.com/llvm/llvm-project/commit/919ca9fc045f84b507bf80332c398a6fc3be1681
DIFF: https://github.com/llvm/llvm-project/commit/919ca9fc045f84b507bf80332c398a6fc3be1681.diff

LOG: [compiler-rt] separate lsan, ubsan, stats configuration from SANITIZER_COMMON_SUPPORTED_OS

Currently, SANITIZER_COMMON_SUPPORTED_OS is being used to enable many libraries.
Unfortunately this makes it impossible to selectively disable a library based on the OS.
This patch removes this limitation by adding a separate list of supported OSs for the lsan, ubsan, ubsan_minimal, and stats libraries.

Reviewed By: delcypher

Differential Revision: https://reviews.llvm.org/D113444

Added: 
    

Modified: 
    compiler-rt/cmake/config-ix.cmake
    compiler-rt/lib/lsan/CMakeLists.txt
    compiler-rt/lib/stats/CMakeLists.txt
    compiler-rt/lib/ubsan/CMakeLists.txt
    compiler-rt/lib/ubsan_minimal/CMakeLists.txt
    compiler-rt/test/ubsan/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 970239486feee..7f449ea11b735 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -394,6 +394,9 @@ if(APPLE)
   set(XRAY_SUPPORTED_OS osx)
   set(FUZZER_SUPPORTED_OS osx)
   set(ORC_SUPPORTED_OS osx)
+  set(UBSAN_SUPPORTED_OS osx)
+  set(LSAN_SUPPORTED_OS osx)
+  set(STATS_SUPPORTED_OS osx)
 
   # Note: In order to target x86_64h on OS X the minimum deployment target must
   # be 10.8 or higher.
@@ -480,6 +483,9 @@ if(APPLE)
           list(APPEND TSAN_SUPPORTED_OS ${platform}sim)
           list(APPEND FUZZER_SUPPORTED_OS ${platform}sim)
           list(APPEND ORC_SUPPORTED_OS ${platform}sim)
+          list(APPEND UBSAN_SUPPORTED_OS ${platform}sim)
+          list(APPEND LSAN_SUPPORTED_OS ${platform}sim)
+          list(APPEND STATS_SUPPORTED_OS ${platform}sim)
         endif()
         foreach(arch ${DARWIN_${platform}sim_ARCHS})
           list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
@@ -511,6 +517,9 @@ if(APPLE)
           endif()
           list(APPEND FUZZER_SUPPORTED_OS ${platform})
           list(APPEND ORC_SUPPORTED_OS ${platform})
+          list(APPEND UBSAN_SUPPORTED_OS ${platform})
+          list(APPEND LSAN_SUPPORTED_OS ${platform})
+          list(APPEND STATS_SUPPORTED_OS ${platform})
         endif()
         foreach(arch ${DARWIN_${platform}_ARCHS})
           list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})

diff  --git a/compiler-rt/lib/lsan/CMakeLists.txt b/compiler-rt/lib/lsan/CMakeLists.txt
index 3fe285c1888b8..1a33950b50a6a 100644
--- a/compiler-rt/lib/lsan/CMakeLists.txt
+++ b/compiler-rt/lib/lsan/CMakeLists.txt
@@ -53,7 +53,7 @@ if(COMPILER_RT_HAS_LSAN)
 
     add_compiler_rt_runtime(clang_rt.lsan
       SHARED
-      OS ${SANITIZER_COMMON_SUPPORTED_OS}
+      OS ${LSAN_SUPPORTED_OS}
       ARCHS ${LSAN_SUPPORTED_ARCH}
       SOURCES ${LSAN_SOURCES}
       ADDITIONAL_HEADERS ${LSAN_HEADERS}

diff  --git a/compiler-rt/lib/stats/CMakeLists.txt b/compiler-rt/lib/stats/CMakeLists.txt
index af58e2533b8d8..60c02556f80d6 100644
--- a/compiler-rt/lib/stats/CMakeLists.txt
+++ b/compiler-rt/lib/stats/CMakeLists.txt
@@ -23,7 +23,7 @@ endif()
 add_compiler_rt_runtime(clang_rt.stats
   ${STATS_LIB_FLAVOR}
   ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH}
-  OS ${SANITIZER_COMMON_SUPPORTED_OS}
+  OS ${STATS_SUPPORTED_OS}
   SOURCES stats.cpp
   ADDITIONAL_HEADERS ${STATS_HEADERS}
   OBJECT_LIBS RTSanitizerCommon
@@ -37,7 +37,7 @@ add_compiler_rt_runtime(clang_rt.stats
 add_compiler_rt_runtime(clang_rt.stats_client
   STATIC
   ARCHS ${SANITIZER_COMMON_SUPPORTED_ARCH}
-  OS ${SANITIZER_COMMON_SUPPORTED_OS}
+  OS ${STATS_SUPPORTED_OS}
   SOURCES stats_client.cpp
   ADDITIONAL_HEADERS ${STATS_HEADERS}
   CFLAGS ${SANITIZER_COMMON_CFLAGS}

diff  --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt
index 189c9c8f07da6..928edf10df528 100644
--- a/compiler-rt/lib/ubsan/CMakeLists.txt
+++ b/compiler-rt/lib/ubsan/CMakeLists.txt
@@ -83,7 +83,7 @@ if(APPLE)
   if(COMPILER_RT_HAS_UBSAN)
     # Initializer of standalone UBSan runtime.
     add_compiler_rt_object_libraries(RTUbsan_standalone
-      OS ${SANITIZER_COMMON_SUPPORTED_OS}
+      OS ${UBSAN_SUPPORTED_OS}
       ARCHS ${UBSAN_SUPPORTED_ARCH}
       SOURCES ${UBSAN_STANDALONE_SOURCES}
       ADDITIONAL_HEADERS ${UBSAN_HEADERS}
@@ -94,7 +94,7 @@ if(APPLE)
 
     add_compiler_rt_runtime(clang_rt.ubsan
       SHARED
-      OS ${SANITIZER_COMMON_SUPPORTED_OS}
+      OS ${UBSAN_SUPPORTED_OS}
       ARCHS ${UBSAN_SUPPORTED_ARCH}
       OBJECT_LIBS RTUbsan
                   RTUbsan_standalone
@@ -108,7 +108,7 @@ if(APPLE)
 
     add_compiler_rt_runtime(clang_rt.ubsan
       STATIC
-      OS ${SANITIZER_COMMON_SUPPORTED_OS}
+      OS ${UBSAN_SUPPORTED_OS}
       ARCHS ${UBSAN_SUPPORTED_ARCH}
       OBJECT_LIBS RTUbsan
                   RTUbsan_standalone

diff  --git a/compiler-rt/lib/ubsan_minimal/CMakeLists.txt b/compiler-rt/lib/ubsan_minimal/CMakeLists.txt
index d7aa8dbcd8bae..504dd3b7573b9 100644
--- a/compiler-rt/lib/ubsan_minimal/CMakeLists.txt
+++ b/compiler-rt/lib/ubsan_minimal/CMakeLists.txt
@@ -26,7 +26,7 @@ if(COMPILER_RT_HAS_UBSAN_MINIMAL)
   # Standalone minimal UBSan runtimes.
   add_compiler_rt_runtime(clang_rt.ubsan_minimal
     STATIC
-    OS ${SANITIZER_COMMON_SUPPORTED_OS}
+    OS ${UBSAN_SUPPORTED_OS}
     ARCHS ${UBSAN_SUPPORTED_ARCH}
     OBJECT_LIBS RTUbsan_minimal
     CFLAGS ${UBSAN_CFLAGS}
@@ -34,7 +34,7 @@ if(COMPILER_RT_HAS_UBSAN_MINIMAL)
 
   add_compiler_rt_runtime(clang_rt.ubsan_minimal
     SHARED
-    OS ${SANITIZER_COMMON_SUPPORTED_OS}
+    OS ${UBSAN_SUPPORTED_OS}
     ARCHS ${UBSAN_SUPPORTED_ARCH}
     OBJECT_LIBS RTUbsan_minimal
     CFLAGS ${UBSAN_CFLAGS}

diff  --git a/compiler-rt/test/ubsan/CMakeLists.txt b/compiler-rt/test/ubsan/CMakeLists.txt
index 5d5f98c4ee3f2..749446320ff3c 100644
--- a/compiler-rt/test/ubsan/CMakeLists.txt
+++ b/compiler-rt/test/ubsan/CMakeLists.txt
@@ -109,7 +109,7 @@ if(APPLE)
   # "check-asan-iossim-x86_64" and similar. They also require that an extra env
   # variable to select which iOS device or simulator to use, e.g.:
   # SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
-  set(UBSAN_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS})
+  set(UBSAN_APPLE_PLATFORMS ${UBSAN_SUPPORTED_OS})
   foreach(platform ${UBSAN_APPLE_PLATFORMS})
     list_intersect(
       UBSAN_TEST_${platform}_ARCHS


        


More information about the llvm-commits mailing list