[PATCH] D124059: [compiler-rt][sanitizers] build ubsan, asan etc libraries with Mac Catalyst support
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 19:47:11 PDT 2022
thakis created this revision.
thakis added a reviewer: hans.
Herald added subscribers: pengfei, mgorny, dberris.
Herald added a project: All.
thakis requested review of this revision.
Like D118875 <https://reviews.llvm.org/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.
https://reviews.llvm.org/D124059
Files:
compiler-rt/cmake/Modules/AddCompilerRT.cmake
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -77,6 +77,17 @@
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
@@ -225,6 +236,21 @@
set(extra_link_flags_${libname} ${DARWIN_${os}_LINK_FLAGS} ${LIB_LINK_FLAGS})
endif()
list_intersect(LIB_ARCHS_${libname} DARWIN_${os}_ARCHS LIB_ARCHS)
+
+ # Build the macOS sanitizers with Mac Catalyst support.
+ if (APPLE AND
+ "${COMPILER_RT_ENABLE_MACCATALYST}" AND
+ "${os}" MATCHES "^(osx)$")
+ foreach(arch ${LIB_ARCHS_${libname}})
+ list(APPEND LIB_CFLAGS
+ -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()
+
if(LIB_ARCHS_${libname})
list(APPEND libnames ${libname})
set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS} ${NO_LTO_FLAGS} ${NO_PGO_FLAGS} ${LIB_CFLAGS})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124059.423794.patch
Type: text/x-patch
Size: 1835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/0bd68b42/attachment.bin>
More information about the llvm-commits
mailing list