Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2022-02-15 01:20:28 +0300
committerAlex Lorenz <arphaman@gmail.com>2022-02-23 06:32:19 +0300
commitf5153d9e72622ac83005e8bf82c4456db6f66689 (patch)
tree5deaddc1dd53903643886228cc706ba4f50a3d96 /compiler-rt
parent251640ab575634256de6d6fde5c5359fe21efe91 (diff)
[compiler-rt][builtins] build the macOS compiler-rt built-ins with Mac Catalyst support
This patch extends compiler-rt's cmake config to build macOS builtins with both macOS and Mac Catalyst support. This is done by telling the compiler to emit macho files with two build version load commands. Differential Revision: https://reviews.llvm.org/D118875
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake8
-rw-r--r--compiler-rt/cmake/base-config-ix.cmake7
2 files changed, 15 insertions, 0 deletions
diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
index 276fcbb9c0e3..2f8cb12e03a4 100644
--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -298,6 +298,14 @@ macro(darwin_add_builtin_library name suffix)
-target "${LIB_ARCH}-apple-${base_os}${DARWIN_${LIBOS}_BUILTIN_MIN_VER}-simulator")
endif()
+ if ("${COMPILER_RT_ENABLE_MACCATALYST}" AND
+ "${LIB_OS}" MATCHES "^osx$")
+ # Build the macOS builtins with Mac Catalyst support.
+ list(APPEND builtin_cflags
+ -target ${LIB_ARCH}-apple-macos${DARWIN_osx_BUILTIN_MIN_VER}
+ -darwin-target-variant ${LIB_ARCH}-apple-ios13.1-macabi)
+ endif()
+
set_target_compile_flags(${libname}
${sysroot_flag}
${DARWIN_${LIB_OS}_BUILTIN_MIN_VER_FLAG}
diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index d7b0124f3546..257666727c8a 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -3,6 +3,7 @@
# .o files. This is particularly useful in producing larger, more complex
# runtime libraries.
+include(BuiltinTests)
include(CheckIncludeFile)
include(CheckCXXSourceCompiles)
include(GNUInstallDirs)
@@ -138,6 +139,12 @@ if(APPLE)
set(OSX_SYSROOT_FLAG "")
endif()
+ try_compile_only(COMPILER_RT_HAS_DARWIN_TARGET_VARIANT_FLAG
+ FLAGS
+ "-target" "x86_64-apple-macos10.15"
+ "-darwin-target-variant" "x86_64-apple-ios13.1-macabi"
+ "-Werror")
+ option(COMPILER_RT_ENABLE_MACCATALYST "Enable building for Mac Catalyst" ${COMPILER_RT_HAS_DARWIN_TARGET_VARIANT_FLAG})
option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off)