[PATCH] D109842: [Compiler-RT] For arm64e test suites use the SDK version as the minimum deployment target.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 15 12:35:15 PDT 2021
delcypher updated this revision to Diff 372774.
delcypher added a comment.
Avoid use of global DARWIN_${platform}_SDK_VERSION variables.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109842/new/
https://reviews.llvm.org/D109842
Files:
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
@@ -250,7 +250,31 @@
endif()
set(test_cflags "")
get_target_flags_for_arch(${arch} test_cflags)
- list(APPEND test_cflags ${DARWIN_${platform}_CFLAGS})
+
+ if (NOT "${arch}" STREQUAL "arm64e")
+ list(APPEND test_cflags ${DARWIN_${platform}_CFLAGS})
+ else()
+ # arm64e is not currently ABI stable so we need to build for the
+ # OS version being tested. Rather than querying the device under test
+ # we use the SDK version which "should" be the same as the
+ # device under test (it is a configuration error for these not to match).
+ # FIXME(dliew): We can remove this if we build the runtimes with the appropriate
+ # deployment target for arm64e.
+ foreach (flag ${DARWIN_${platform}_CFLAGS})
+ if ("${flag}" MATCHES "^${DARWIN_${platform}_MIN_VER_FLAG}=.+")
+ # Find the SDK version
+ get_xcrun_platform_from_apple_platform("${platform}" xcrun_platform_name)
+ find_darwin_sdk_version(platform_sdk_version "${xcrun_platform_name}")
+ # Patch flag with correct deployment target
+ set(replacement_flag "${DARWIN_${platform}_MIN_VER_FLAG}=${platform_sdk_version}")
+ list(APPEND test_cflags "${replacement_flag}")
+ else()
+ # Copy through
+ list(APPEND test_cflags "${flag}")
+ endif()
+ endforeach()
+ endif()
+
string(REPLACE ";" " " test_cflags_str "${test_cflags}")
string(APPEND test_cflags_str "${COMPILER_RT_TEST_COMPILER_CFLAGS}")
set(${cflags_out} "${test_cflags_str}" PARENT_SCOPE)
@@ -279,6 +303,30 @@
set(${is_valid_out} ${is_valid} PARENT_SCOPE)
endfunction()
+# Maps the Apple platform name used in Compiler-rt's CMake code
+# to the name recognised by xcrun's `--sdk` argument
+function(get_xcrun_platform_from_apple_platform platform out_var)
+ set(xcrun_platform "")
+ if ("${platform}" STREQUAL "osx")
+ set(xcrun_platform "macosx")
+ elseif ("${platform}" STREQUAL "iossim")
+ set(xcrun_platform "iphonesimulator")
+ elseif ("${platform}" STREQUAL "ios")
+ set(xcrun_platform "iphoneos")
+ elseif ("${platform}" STREQUAL "watchossim")
+ set(xcrun_platform "watchsimulator")
+ elseif ("${platform}" STREQUAL "watchos")
+ set(xcrun_platform "watchos")
+ elseif ("${platform}" STREQUAL "tvossim")
+ set(xcrun_platform "appletvsimulator")
+ elseif ("${platform}" STREQUAL "tvos")
+ set(xcrun_platform "appletvos")
+ else()
+ message(FATAL_ERROR "\"${platform}\" is not a handled apple platform")
+ endif()
+ set(${out_var} ${xcrun_platform} PARENT_SCOPE)
+endfunction()
+
include(AllSupportedArchDefs)
if(APPLE)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109842.372774.patch
Type: text/x-patch
Size: 2781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210915/dbccc28f/attachment.bin>
More information about the llvm-commits
mailing list