[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 11:28:54 PDT 2021
delcypher created this revision.
delcypher added reviewers: yln, kubamracek, aralisza, jkorous.
Herald added subscribers: kristof.beyls, mgorny, dberris.
delcypher requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
Previously we used the minimum deployment target used for the platform
(e.g. iOS is 9.0). Unfortunately this leads to ABI incompatibilities with
arm64e devices running newer OSs. In particular the following TSan test
cases that used libcxx would fail due to the ABI mismatch.
- Darwin/libcxx-shared-ptr-recursive.mm
- Darwin/libcxx-shared-ptr-stress.mm
- Darwin/libcxx-shared-ptr.mm
- libcxx/std_shared_ptr.cpp
Given that arm64e is not ABI stable we should ideally match the
deployment target for sanitizer runtimes and their tests cases to the
device when building for arm64e. Unfortunately having a mixed deployment
target (based on architecture) isn't currently supported by the build system
and is non-trivial to implement.
As a stop-gap measure this patch changes the sanitizer test suites (but not the
sanitizer runtimes themselves) to use a newer deployment target when
targetting arm64e.
The deployment target used for arm64e is the SDK version because this
"should" match the OS version running on the target device (it is a
configuration error to not match them).
rdar://83080611
Repository:
rG LLVM Github Monorepo
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,28 @@
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}=.+")
+ # Patch flag with correct deployment target
+ set(replacement_flag "${DARWIN_${platform}_MIN_VER_FLAG}=${DARWIN_${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)
@@ -292,6 +313,14 @@
find_darwin_sdk_dir(DARWIN_tvossim_SYSROOT appletvsimulator)
find_darwin_sdk_dir(DARWIN_tvos_SYSROOT appletvos)
+ find_darwin_sdk_version(DARWIN_osx_SDK_VERSION macosx)
+ find_darwin_sdk_version(DARWIN_iossim_SDK_VERSION iphonesimulator)
+ find_darwin_sdk_version(DARWIN_ios_SDK_VERSION iphoneos)
+ find_darwin_sdk_version(DARWIN_watchossim_SDK_VERSION watchsimulator)
+ find_darwin_sdk_version(DARWIN_watchos_SDK_VERSION watchos)
+ find_darwin_sdk_version(DARWIN_tvossim_SDK_VERSION appletvsimulator)
+ find_darwin_sdk_version(DARWIN_tvos_SDK_VERSION appletvos)
+
if(NOT DARWIN_osx_SYSROOT)
message(WARNING "Could not determine OS X sysroot, trying /usr/include")
if(EXISTS /usr/include)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109842.372761.patch
Type: text/x-patch
Size: 2254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210915/1fe4d523/attachment.bin>
More information about the llvm-commits
mailing list