[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 20:03:55 PDT 2022


thakis updated this revision to Diff 423799.
thakis added a comment.

better


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124059/new/

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
@@ -234,6 +245,19 @@
         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})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124059.423799.patch
Type: text/x-patch
Size: 1734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/4bbc20fc/attachment.bin>


More information about the llvm-commits mailing list