[PATCH] D117924: [compiler_rt] Add a seperate runtime for Mac Catalyst
Byoungchan Lee via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 21 13:15:27 PST 2022
bc-lee created this revision.
Herald added a subscriber: mgorny.
bc-lee requested review of this revision.
Herald added projects: clang, Sanitizers.
Herald added subscribers: Sanitizers, cfe-commits.
Mac Catalyst has different platform fields in build_version_command,
so it's natural to create a separate libclang_rt.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117924
Files:
clang/lib/Driver/ToolChains/Darwin.cpp
compiler-rt/cmake/builtin-config-ix.cmake
compiler-rt/cmake/config-ix.cmake
Index: compiler-rt/cmake/config-ix.cmake
===================================================================
--- compiler-rt/cmake/config-ix.cmake
+++ compiler-rt/cmake/config-ix.cmake
@@ -310,7 +310,7 @@
if ("${platform}" STREQUAL "")
message(FATAL_ERROR "platform cannot be empty")
endif()
- if ("${platform}" MATCHES "^(osx|((ios|watchos|tvos)(sim)?))$")
+ if ("${platform}" MATCHES "^(osx|((ios|watchos|tvos)(sim)?)|catalyst)$")
set(is_valid TRUE)
endif()
set(${is_valid_out} ${is_valid} PARENT_SCOPE)
@@ -347,6 +347,7 @@
include(CompilerRTDarwinUtils)
find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx)
+ find_darwin_sdk_dir(DARWIN_catalyst_SYSROOT macosx)
find_darwin_sdk_dir(DARWIN_iossim_SYSROOT iphonesimulator)
find_darwin_sdk_dir(DARWIN_ios_SYSROOT iphoneos)
find_darwin_sdk_dir(DARWIN_watchossim_SYSROOT watchsimulator)
@@ -372,6 +373,12 @@
set(DARWIN_iossim_MIN_VER_FLAG -mios-simulator-version-min)
set(DARWIN_iossim_SANITIZER_MIN_VER_FLAG
${DARWIN_iossim_MIN_VER_FLAG}=${DARWIN_ios_MIN_VER})
+ list(APPEND DARWIN_EMBEDDED_PLATFORMS catalyst)
+ set(DARWIN_catalyst_MIN_VER 13.0)
+ set(DARWIN_catalyst_SANITIZER_MIN_VER_FLAG
+ ${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_catalyst_MIN_VER}
+ -target
+ ${LIB_ARCH}-apple-ios${DARWIN_catalyst_MIN_VER}-macabi)
endif()
if(COMPILER_RT_ENABLE_WATCHOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
@@ -499,6 +506,10 @@
endforeach()
endif()
+ if("${platform}" STREQUAL "catalyst")
+ set(DARWIN_${platform}_SKIP_CC_KEXT On)
+ endif()
+
if(DARWIN_${platform}_SYSROOT)
set(DARWIN_${platform}_CFLAGS
${DARWIN_COMMON_CFLAGS}
Index: compiler-rt/cmake/builtin-config-ix.cmake
===================================================================
--- compiler-rt/cmake/builtin-config-ix.cmake
+++ compiler-rt/cmake/builtin-config-ix.cmake
@@ -71,6 +71,7 @@
if(APPLE)
find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx)
+ find_darwin_sdk_dir(DARWIN_catalyst_SYSROOT macosx)
find_darwin_sdk_dir(DARWIN_iossim_SYSROOT iphonesimulator)
find_darwin_sdk_dir(DARWIN_ios_SYSROOT iphoneos)
find_darwin_sdk_dir(DARWIN_watchossim_SYSROOT watchsimulator)
@@ -115,7 +116,14 @@
set(DARWIN_ios_BUILTIN_MIN_VER_FLAG
${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_ios_BUILTIN_MIN_VER})
set(DARWIN_ios_BUILTIN_ALL_POSSIBLE_ARCHS ${ARM64} ${ARM32})
- set(DARWIN_iossim_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64})
+ set(DARWIN_iossim_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64} ${ARM64})
+ list(APPEND DARWIN_EMBEDDED_PLATFORMS catalyst)
+ set(DARWIN_catalyst_BUILTIN_MIN_VER 13.0)
+ set(DARWIN_catalyst_BUILTIN_MIN_VER_FLAG
+ ${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_catalyst_BUILTIN_MIN_VER}
+ -target
+ ${LIB_ARCH}-apple-ios${DARWIN_catalyst_BUILTIN_MIN_VER}-macabi)
+ set(DARWIN_catalyst_BUILTIN_ALL_POSSIBLE_ARCHS ${X86_64} ${ARM64})
endif()
if(COMPILER_RT_ENABLE_WATCHOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
@@ -178,6 +186,10 @@
endforeach()
endif()
+ if("${platform}" STREQUAL "catalyst")
+ set(DARWIN_${platform}_SKIP_CC_KEXT On)
+ endif()
+
if(DARWIN_${platform}_SYSROOT)
darwin_test_archs(${platform}
DARWIN_${platform}_BUILTIN_ARCHS
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1219,7 +1219,7 @@
return "osx";
case DarwinPlatformKind::IPhoneOS:
if (TargetEnvironment == MacCatalyst)
- return "osx";
+ return "catalyst";
return TargetEnvironment == NativeEnvironment || IgnoreSim ? "ios"
: "iossim";
case DarwinPlatformKind::TvOS:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117924.402092.patch
Type: text/x-patch
Size: 3892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220121/03517f8f/attachment.bin>
More information about the cfe-commits
mailing list