[compiler-rt] 6df9b06 - [Sanitizers][Darwin][ASanABI] Fix architecture config for ASan Abi

Blue Gaston via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 14:12:00 PDT 2023


Author: Blue Gaston
Date: 2023-06-01T14:11:47-07:00
New Revision: 6df9b06aa81f7b6eea34652ddff819afc07a874f

URL: https://github.com/llvm/llvm-project/commit/6df9b06aa81f7b6eea34652ddff819afc07a874f
DIFF: https://github.com/llvm/llvm-project/commit/6df9b06aa81f7b6eea34652ddff819afc07a874f.diff

LOG: [Sanitizers][Darwin][ASanABI] Fix architecture config for ASan Abi

Moved setting supported architecture to parent cmake configuration files
so they can be read by both lib and test CMakeList.txt.

Fixed issue with check-asan-abi that did not filter for current host architecture
which caused x86_64 bots to run Arm64 tests.

Added x86_64 as a supported arch to the test cmake file.

rdar://110017569

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

Added: 
    

Modified: 
    compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
    compiler-rt/cmake/config-ix.cmake
    compiler-rt/lib/asan_abi/CMakeLists.txt
    compiler-rt/test/asan_abi/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
index 3892dd7a6f453..15c39233685cc 100644
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -29,6 +29,7 @@ set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64}
 set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
     ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
     ${LOONGARCH64})
+set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64})
 set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
 
 if(ANDROID)

diff  --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index df1598dade737..1b8d6640eb443 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -590,6 +590,7 @@ if(APPLE)
     )
   set(LSAN_COMMON_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})
   set(UBSAN_COMMON_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})
+  set(ASAN_ABI_SUPPORTED_ARCH ${ALL_ASAN_ABI_SUPPORTED_ARCH})
   list_intersect(ASAN_SUPPORTED_ARCH
     ALL_ASAN_SUPPORTED_ARCH
     SANITIZER_COMMON_SUPPORTED_ARCH)

diff  --git a/compiler-rt/lib/asan_abi/CMakeLists.txt b/compiler-rt/lib/asan_abi/CMakeLists.txt
index 62d5537348144..b2f5ddba8b085 100644
--- a/compiler-rt/lib/asan_abi/CMakeLists.txt
+++ b/compiler-rt/lib/asan_abi/CMakeLists.txt
@@ -15,11 +15,10 @@ add_compiler_rt_component(asan_abi)
 if (APPLE)
   # TODO: set in config-ix.cmake
   set(ASAN_ABI_SUPPORTED_OS osx)
-  set(ASAN_ABI_SUPPORTED_ARCHS ${X86_64} ${ARM64})
   # Compile Stable API sources into an object library.
   add_compiler_rt_object_libraries(RTASAN_ABI
     OS ${ASAN_ABI_SUPPORTED_OS}
-    ARCHS ${ASAN_ABI_SUPPORTED_ARCHS}
+    ARCHS ${ASAN_ABI_SUPPORTED_ARCH}
     SOURCES ${ASAN_ABI_SOURCES}
     ADDITIONAL_HEADERS ${ASAN_ABI_HEADERS}
     CFLAGS ${SANITIZER_COMMON_CFLAGS})
@@ -27,7 +26,7 @@ if (APPLE)
   add_compiler_rt_runtime(clang_rt.asan_abi
     STATIC
     OS ${ASAN_ABI_SUPPORTED_OS}
-    ARCHS ${ASAN_ABI_SUPPORTED_ARCHS}
+    ARCHS ${ASAN_ABI_SUPPORTED_ARCH}
     OBJECT_LIBS RTASAN_ABI
     CFLAGS ${SANITIZER_COMMON_CFLAGS}
     LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS}

diff  --git a/compiler-rt/test/asan_abi/CMakeLists.txt b/compiler-rt/test/asan_abi/CMakeLists.txt
index 5d03716e68bff..e3e41c0e5ef12 100644
--- a/compiler-rt/test/asan_abi/CMakeLists.txt
+++ b/compiler-rt/test/asan_abi/CMakeLists.txt
@@ -3,7 +3,7 @@ set(ASAN_ABI_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 set(ASAN_ABI_TESTSUITES)
 
 macro(get_bits_for_arch arch bits)
-  if (${arch} MATCHES "arm64")
+  if (${arch} MATCHES "arm64|x86_64")
     set(${bits} 64)
   else()
     message(FATAL_ERROR "Unknown target architecture: ${arch}")
@@ -16,7 +16,10 @@ if(NOT COMPILER_RT_STANDALONE_BUILD)
 endif()
 set(ASAN_ABI_DYNAMIC_TEST_DEPS ${ASAN_ABI_TEST_DEPS})
 
-set(ASAN_ABI_TEST_ARCH arm64)
+set(ASAN_ABI_TEST_ARCH ${ASAN_ABI_SUPPORTED_ARCH})
+if(APPLE)
+  darwin_filter_host_archs(ASAN_ABI_SUPPORTED_ARCH ASAN_ABI_TEST_ARCH)
+endif()
 
 foreach(arch ${ASAN_ABI_TEST_ARCH})
   set(ASAN_ABI_TEST_TARGET_ARCH ${arch})


        


More information about the llvm-commits mailing list