[compiler-rt] 7d2cc88 - [compiler-rt][sanitizers] build ubsan, asan etc libraries with Mac Catalyst support
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 06:22:33 PDT 2022
Author: Nico Weber
Date: 2022-04-20T09:22:25-04:00
New Revision: 7d2cc882d5e0f0afe595a2cfe18eb29506341cd3
URL: https://github.com/llvm/llvm-project/commit/7d2cc882d5e0f0afe595a2cfe18eb29506341cd3
DIFF: https://github.com/llvm/llvm-project/commit/7d2cc882d5e0f0afe595a2cfe18eb29506341cd3.diff
LOG: [compiler-rt][sanitizers] build ubsan, asan etc libraries with Mac Catalyst support
Like D118875, but for ubsan, asan, etc.
With this, I can successfully run:
bin/clang++ -target x86_64-apple-ios14.0-macabi foo.cc \
-isysroot $(xcrun -show-sdk-path) -fsanitize=undefined
with a locally built libclang_rt.ubsan_osx_dynamic.dylib.
Differential Revision: https://reviews.llvm.org/D124059
Added:
Modified:
compiler-rt/cmake/Modules/AddCompilerRT.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index ae6d1eaf6bb82..280a39311491d 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -77,6 +77,17 @@ function(add_compiler_rt_object_libraries name)
list(REMOVE_ITEM target_flags "-msse3")
endif()
+ # Build the macOS sanitizers with Mac Catalyst support.
+ if (APPLE AND
+ "${COMPILER_RT_ENABLE_MACCATALYST}" AND
+ "${libname}" MATCHES ".*\.osx.*")
+ foreach(arch ${LIB_ARCHS_${libname}})
+ list(APPEND target_flags
+ -target ${arch}-apple-macos${DARWIN_osx_MIN_VER}
+ -darwin-target-variant ${arch}-apple-ios13.1-macabi)
+ endforeach()
+ endif()
+
set_target_compile_flags(${libname}
${extra_cflags_${libname}} ${target_flags})
set_property(TARGET ${libname} APPEND PROPERTY
@@ -234,6 +245,19 @@ function(add_compiler_rt_runtime name type)
get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} output_dir_${libname})
get_compiler_rt_install_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} install_dir_${libname})
endif()
+
+ # Build the macOS sanitizers with Mac Catalyst support.
+ if ("${COMPILER_RT_ENABLE_MACCATALYST}" AND
+ "${os}" MATCHES "^(osx)$")
+ foreach(arch ${LIB_ARCHS_${libname}})
+ list(APPEND extra_cflags_${libname}
+ -target ${arch}-apple-macos${DARWIN_osx_MIN_VER}
+ -darwin-target-variant ${arch}-apple-ios13.1-macabi)
+ list(APPEND extra_link_flags_${libname}
+ -target ${arch}-apple-macos${DARWIN_osx_MIN_VER}
+ -darwin-target-variant ${arch}-apple-ios13.1-macabi)
+ endforeach()
+ endif()
endforeach()
else()
foreach(arch ${LIB_ARCHS})
More information about the llvm-commits
mailing list