mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When we fall back to loading an arm64e module interface during an arm64 build, we want to compile it for the arm64 target so that it is fully compatible with the module that will load it, even though the flags in the file specify the arm64e target. Rewrite the sub-invocation's TargetTriple property in this specific situation. If the two targets differ by more than just the sub-architecture, we will continue to respect the -target flag in the file. Fixes <rdar://83056545>.
43 lines
981 B
Swift
43 lines
981 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-typecheck-verify-swift -F %S/Inputs -module-cache-path %t -verify-ignore-unknown -Rmodule-interface-rebuild
|
|
|
|
// PtrAuthFramework only supports these OSes.
|
|
//
|
|
// REQUIRES: OS=tvos || OS=macosx || OS=ios
|
|
|
|
// When run on arm64, this tests that we fall back to the arm64e interface, but
|
|
// build it with `#if _ptrauth(_arm64e)` off.
|
|
//
|
|
// When run on arm64e, this tests that we build the same interface with
|
|
// `#if _ptrauth(_arm64e)` on.
|
|
//
|
|
// REQUIRES: CPU=arm64 || CPU=arm64e
|
|
|
|
import PtrAuthFramework // expected-remark{{rebuilding module 'PtrAuthFramework' from interface}}
|
|
|
|
#if os(iOS)
|
|
|
|
#if _ptrauth(_arm64e)
|
|
public let x: Bool = iOSPtrAuth
|
|
#else
|
|
public let x: Bool = iOSNotPtrAuth
|
|
#endif
|
|
|
|
#elseif os(macOS)
|
|
|
|
#if _ptrauth(_arm64e)
|
|
public let x: Bool = macOSPtrAuth
|
|
#else
|
|
public let x: Bool = macOSNotPtrAuth
|
|
#endif
|
|
|
|
#else
|
|
|
|
#if _ptrauth(_arm64e)
|
|
public let x: Bool = tvOSPtrAuth
|
|
#else
|
|
public let x: Bool = tvOSNotPtrAuth
|
|
#endif
|
|
|
|
#endif
|