-
Notifications
You must be signed in to change notification settings - Fork 15k
[PAC][ELF] Place AUTH constants in .data.rel.ro for position dependent code #150418
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
Open
kovdan01
wants to merge
5
commits into
llvm:main
Choose a base branch
from
kovdan01:pauth-data-rel-ro
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a91b0ee
[PAC][ELF] Place AUTH constants in .data.rel.ro for position dependen…
kovdan01 bf6186d
Merge branch 'main' into pauth-data-rel-ro
kovdan01 d85f8cf
Address review comments
kovdan01 1868cbe
Merge branch 'main' into pauth-data-rel-ro
kovdan01 cafc9df
Apply Anatoly's suggestion
kovdan01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| ; RUN: llc -mtriple aarch64-elf --relocation-model=static -mattr=+pauth < %s | FileCheck %s | ||
| ; RUN: llc -mtriple aarch64-elf --relocation-model=dynamic-no-pic -mattr=+pauth < %s | FileCheck %s | ||
|
|
||
| ;; A constant value, use .rodata | ||
| ; CHECK: .section .rodata,"a",@progbits | ||
| ; CHECK: .globl Const | ||
| ; CHECK: Const: | ||
| ; CHECK: .xword 37 | ||
|
|
||
| ;; An AUTH reloc is needed, use .data.rel.ro | ||
| ; CHECK: .section .data.rel.ro,"aw",@progbits | ||
| ; CHECK: .globl PtrAuthExtern | ||
| ; CHECK: PtrAuthExtern: | ||
| ; CHECK: .xword ConstExtern@AUTH(da,0) | ||
|
|
||
| ; CHECK: .globl PtrAuth | ||
| ; CHECK: PtrAuth: | ||
| ; CHECK: .xword Const@AUTH(da,0) | ||
|
|
||
| ; CHECK: .globl PtrAuthExternNested1 | ||
| ; CHECK: PtrAuthExternNested1: | ||
| ; CHECK: .xword ConstExtern@AUTH(da,0) | ||
|
|
||
| ;; The address could be filled statically, use .rodata | ||
| ; CHECK: .section .rodata,"a",@progbits | ||
| ; CHECK: .globl PtrAuthExternNested2 | ||
| ; CHECK: PtrAuthExternNested2: | ||
| ; CHECK: .xword PtrAuthExtern | ||
|
|
||
| ;; An AUTH reloc is needed, use .data.rel.ro | ||
| ; CHECK: .section .data.rel.ro,"aw",@progbits | ||
| ; CHECK: .globl PtrAuthNested1 | ||
| ; CHECK: PtrAuthNested1: | ||
| ; CHECK: .xword Const@AUTH(da,0) | ||
|
|
||
| ;; The address could be filled statically, use .rodata | ||
| ; CHECK: .section .rodata,"a",@progbits | ||
| ; CHECK: .globl PtrAuthNested2 | ||
| ; CHECK: PtrAuthNested2: | ||
| ; CHECK: .xword PtrAuth | ||
|
|
||
| @ConstExtern = external global i64 | ||
| @Const = constant i64 37 | ||
|
|
||
| @PtrAuthExtern = constant ptr ptrauth (ptr @ConstExtern, i32 2) | ||
| @PtrAuth = constant ptr ptrauth (ptr @Const, i32 2) | ||
|
|
||
| @PtrAuthExternNested1 = constant { ptr } { ptr ptrauth (ptr @ConstExtern, i32 2) } | ||
| @PtrAuthExternNested2 = constant { ptr } { ptr @PtrAuthExtern } | ||
| @PtrAuthNested1 = constant { ptr } { ptr ptrauth (ptr @Const, i32 2) } | ||
| @PtrAuthNested2 = constant { ptr } { ptr @PtrAuth } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
IIUC this would make
containsConstantPtrAuthreturn false for global variable like thiswhich is still "constant" (as a constant pointer to
global_var). This doesn't seem to hurt in case of this PR, but possibly a bit unexpected w.r.t. function name vs. its behavior.Uh oh!
There was an error while loading. Please reload this page.
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.
On the other hand, I would expect
containsConstantPtrAuthto return false for@ptr_to_global_var = constant ptr @global_varno matter how@global_valueis defined - I guess recursively inspectingGlobalValues would makecontainsConstantPtrAuthincorrectly returntruein such cases. Thus, the original "issue" should be considered as a matter of comments or naming, if at all.