-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add arm64e and pointer authentication support for Swift #30112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The IRGen test conflicts should be trivial to fix: in this patch, the 64-bit test line has been split into ptrauth and non-ptrauth variants, so non just copy the new symbol name from the single 64-bit line into both, preserving the |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
1 similar comment
@swift-ci please test |
Build failed |
@swift-ci please test |
Build failed |
@swift-ci please test |
@swift-ci please test |
Build failed |
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This broke builds for me:
<swift>/stdlib/public/runtime/Metadata.cpp:4645:40: error: expression is not an integer constant expression
witness = ptrauth_auth_data(witness, swift_ptrauth_key_associated_type,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<clang>/usr/lib/clang/11.0.0/include/ptrauth.h:236:35: note: expanded from macro 'ptrauth_auth_data'
__builtin_ptrauth_auth(__value, __old_key, __old_data)
^~~~~~~~~
<swift>/stdlib/public/runtime/Metadata.cpp:4767:40: error: expression is not an integer constant expression
witness = ptrauth_auth_data(witness, swift_ptrauth_key_associated_type,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<clang>/usr/lib/clang/11.0.0/include/ptrauth.h:236:35: note: expanded from macro 'ptrauth_auth_data'
__builtin_ptrauth_auth(__value, __old_key, __old_data)
^~~~~~~~~
<swift>/stdlib/public/runtime/Metadata.cpp:4818:26: error: expression is not an integer constant expression
witness, swift_ptrauth_key_associated_conformance,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<clang>/usr/lib/clang/11.0.0/include/ptrauth.h:236:35: note: expanded from macro 'ptrauth_auth_data'
__builtin_ptrauth_auth(__value, __old_key, __old_data)
^~~~~~~~~
<swift>/stdlib/public/runtime/Metadata.cpp:4894:40: error: expression is not an integer constant expression
witness = ptrauth_auth_data(witness, swift_ptrauth_key_associated_conformance,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<clang>/usr/lib/clang/11.0.0/include/ptrauth.h:236:35: note: expanded from macro 'ptrauth_auth_data'
__builtin_ptrauth_auth(__value, __old_key, __old_data)
^~~~~~~~~
4 errors generated.
@@ -4207,6 +4301,110 @@ static bool doesNotRequireInstantiation( | |||
return true; | |||
} | |||
|
|||
static const unsigned swift_ptrauth_key_associated_type = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it intentional to assign this variable to itself? Clang accepts this without warning :/
swift_ptrauth_init(slot, witness, reqt.Flags.getExtraDiscriminator()); | ||
} | ||
|
||
static const unsigned swift_ptrauth_key_associated_conformance = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
@@ -4207,6 +4301,110 @@ static bool doesNotRequireInstantiation( | |||
return true; | |||
} | |||
|
|||
static const unsigned swift_ptrauth_key_associated_type = | |||
swift_ptrauth_key_associated_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any way to expand the context around my previous comment, so this is where the self-assignment is happening.
Ah, I see #30363. |
swiftlang/swift#30112 makes the Swift standard library for iOS build for arm64e. If you're building Swift against your own LLVM, this in turn requires having the builtins built for arm64e, otherwise you won't be able to use the builtins (which will in turn lead to an undefined symbol for `__isOSVersionAtLeast`). Make the builtins build for arm64e to fix this. Differential Revision: https://reviews.llvm.org/D76041
swiftlang/swift#30112 makes the Swift standard library for iOS build for arm64e. If you're building Swift against your own LLVM, this in turn requires having the builtins built for arm64e, otherwise you won't be able to use the builtins (which will in turn lead to an undefined symbol for `__isOSVersionAtLeast`). Make the builtins build for arm64e to fix this. Differential Revision: https://reviews.llvm.org/D76041
swiftlang/swift#30112 makes the Swift standard library for iOS build for arm64e. If you're building Swift against your own LLVM, this in turn requires having the builtins built for arm64e, otherwise you won't be able to use the builtins (which will in turn lead to an undefined symbol for `__isOSVersionAtLeast`). Make the builtins build for arm64e to fix this. Differential Revision: https://reviews.llvm.org/D76041
This PR upstreams the internally developed support for arm64e and pointer authentication in Swift. For details about pointer authentication, see http://lists.llvm.org/pipermail/llvm-dev/2019-October/136091.html, and for the LLVM and Clang changes, see swiftlang/llvm-project#14. This work is primarily authored by John McCall, with many smaller contributions by several others at Apple including myself.