[compiler-rt] f5153d9 - [compiler-rt][builtins] build the macOS compiler-rt built-ins with Mac Catalyst support
Alex Lorenz via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 22 19:32:46 PST 2022
Author: Alex Lorenz
Date: 2022-02-22T19:32:19-08:00
New Revision: f5153d9e72622ac83005e8bf82c4456db6f66689
URL: https://github.com/llvm/llvm-project/commit/f5153d9e72622ac83005e8bf82c4456db6f66689
DIFF: https://github.com/llvm/llvm-project/commit/f5153d9e72622ac83005e8bf82c4456db6f66689.diff
LOG: [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
Added:
Modified:
compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
compiler-rt/cmake/base-config-ix.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
index 276fcbb9c0e3c..2f8cb12e03a40 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 d7b0124f35463..257666727c8ad 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)
More information about the llvm-commits
mailing list