-
Notifications
You must be signed in to change notification settings - Fork 15.7k
[AArch64][PAC] Lower ptrauth constants in code for MachO. #97665
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,24 +43,19 @@ MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs( | |
| return List; | ||
| } | ||
|
|
||
| template <typename MachineModuleInfoTarget> | ||
| static typename MachineModuleInfoTarget::AuthStubListTy getAuthGVStubListHelper( | ||
| DenseMap<MCSymbol *, typename MachineModuleInfoTarget::AuthStubInfo> | ||
| &AuthPtrStubs) { | ||
| typename MachineModuleInfoTarget::AuthStubListTy List(AuthPtrStubs.begin(), | ||
| AuthPtrStubs.end()); | ||
| using ExprStubPairTy = std::pair<MCSymbol *, const MCExpr *>; | ||
| static int SortAuthStubPair(const ExprStubPairTy *LHS, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably worth adding a test which checks that stubs are sorted. I'm OK with merging this "as is" and implementing new tests as a separate patch later.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, the ordering doesn't matter as long as it's stable; I added another extern_weak as the barest of sanity checks. |
||
| const ExprStubPairTy *RHS) { | ||
| return LHS->first->getName().compare(RHS->first->getName()); | ||
| } | ||
|
|
||
| if (!List.empty()) | ||
| llvm::sort(List.begin(), List.end(), | ||
| [](const typename MachineModuleInfoTarget::AuthStubPairTy &LHS, | ||
| const typename MachineModuleInfoTarget::AuthStubPairTy &RHS) { | ||
| return LHS.first->getName() < RHS.first->getName(); | ||
| }); | ||
| MachineModuleInfoImpl::ExprStubListTy MachineModuleInfoImpl::getSortedExprStubs( | ||
| DenseMap<MCSymbol *, const MCExpr *> &ExprStubs) { | ||
| MachineModuleInfoImpl::ExprStubListTy List(ExprStubs.begin(), | ||
| ExprStubs.end()); | ||
|
|
||
| AuthPtrStubs.clear(); | ||
| return List; | ||
| } | ||
| array_pod_sort(List.begin(), List.end(), SortAuthStubPair); | ||
|
|
||
| MachineModuleInfoELF::AuthStubListTy MachineModuleInfoELF::getAuthGVStubList() { | ||
| return getAuthGVStubListHelper<MachineModuleInfoELF>(AuthPtrStubs); | ||
| ExprStubs.clear(); | ||
| return List; | ||
| } | ||
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.
Just in case you've missed that - currently, there is no addend support for
$auth_ptr$symbols - seegetAuthPtrSlotSymbolHelper. It's probably worth mentioning that addend is optional in this comment. Feel free to ignore though.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.
Right, I don't think we'll ever need the addend support here, I'm keeping it downstream for some other use-cases.
I should mention we're also missing the address-diversity support here, and that one we'll likely want to add here in the future, at least for MachO; we'll see then whether it's needed for ELF, given the broader support for auth GOT relocations that MachO doesn't expose.