-
Notifications
You must be signed in to change notification settings - Fork 15.5k
CodeGen: Optionally emit PAuth relocations as IRELATIVE relocations. #133533
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 all commits
46a1dbc
005ee2d
f0582ee
f63460a
a51d67b
b2a4e53
fb8ed1e
eb29698
99accf2
5757a4b
7e9ff5f
d9112ca
c83ac0d
96634a7
e3d45ba
dd4ef4e
2d46b4d
6a1c243
f00843f
cfb68af
ccf433b
566b335
e559f05
691a8b1
5d04950
03bf1a1
7ed12ae
e4e4b96
725889f
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 |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| ; RUN: llc -mtriple aarch64-linux-gnu -mattr=+pauth -filetype=asm -o - %s | FileCheck %s | ||
|
|
||
| ; CHECK: nullref: | ||
| ; CHECK-NEXT: [[PLACE:.*]]: | ||
| ; CHECK-NEXT: .section .text.startup | ||
| ; CHECK-NEXT: [[FUNC:.*]]: | ||
| ; CHECK-NEXT: movz x0, #0 | ||
| ; CHECK-NEXT: mov x1, #1 | ||
| ; CHECK-NEXT: b __emupac_pacda | ||
| ; CHECK-NEXT: .section .rodata | ||
| ; CHECK-NEXT: .xword [[FUNC]]@FUNCINIT | ||
| @nullref = constant ptr ptrauth (ptr null, i32 2, i64 1, ptr null), align 8 | ||
|
|
||
| @dsolocal = external dso_local global i8 | ||
|
|
||
| ; CHECK: dsolocalref: | ||
| ; CHECK-NEXT: [[PLACE:.*]]: | ||
| ; CHECK-NEXT: .section .text.startup | ||
| ; CHECK-NEXT: [[FUNC:.*]]: | ||
| ; CHECK-NEXT: adrp x0, dsolocal | ||
| ; CHECK-NEXT: add x0, x0, :lo12:dsolocal | ||
| ; CHECK-NEXT: mov x1, #2 | ||
| ; CHECK-NEXT: b __emupac_pacda | ||
| ; CHECK-NEXT: .section .rodata | ||
| ; CHECK-NEXT: .xword [[FUNC]]@FUNCINIT | ||
| @dsolocalref = constant ptr ptrauth (ptr @dsolocal, i32 2, i64 2, ptr null), align 8 | ||
|
|
||
| ; CHECK: dsolocalref8: | ||
| ; CHECK-NEXT: [[PLACE:.*]]: | ||
| ; CHECK-NEXT: .section .text.startup | ||
| ; CHECK-NEXT: [[FUNC:.*]]: | ||
| ; CHECK-NEXT: adrp x0, dsolocal+8 | ||
| ; CHECK-NEXT: add x0, x0, :lo12:dsolocal+8 | ||
| ; CHECK-NEXT: mov x1, #3 | ||
| ; CHECK-NEXT: b __emupac_pacda | ||
| ; CHECK-NEXT: .section .rodata | ||
| ; CHECK-NEXT: .xword [[FUNC]]@FUNCINIT | ||
| @dsolocalref8 = constant ptr ptrauth (ptr getelementptr (i8, ptr @dsolocal, i64 8), i32 2, i64 3, ptr null), align 8 | ||
|
|
||
| ; CHECK: disc: | ||
| ; CHECK-NEXT: [[PLACE:.*]]: | ||
| ; CHECK-NEXT: .section .text.startup | ||
| ; CHECK-NEXT: [[FUNC:.*]]: | ||
| ; CHECK-NEXT: adrp x0, dsolocal | ||
| ; CHECK-NEXT: add x0, x0, :lo12:dsolocal | ||
| ; CHECK-NEXT: adrp x1, [[PLACE]] | ||
| ; CHECK-NEXT: add x1, x1, :lo12:[[PLACE]] | ||
| ; CHECK-NEXT: b __emupac_pacda | ||
| ; CHECK-NEXT: .section .rodata | ||
| ; CHECK-NEXT: .xword [[FUNC]]@FUNCINIT | ||
| @disc = constant ptr ptrauth (ptr @dsolocal, i32 2, i64 0, ptr @disc), align 8 | ||
|
|
||
| @global = external global i8 | ||
|
|
||
| ; CHECK: globalref: | ||
| ; CHECK-NEXT: [[PLACE:.*]]: | ||
| ; CHECK-NEXT: .section .text.startup | ||
| ; CHECK-NEXT: [[FUNC:.*]]: | ||
| ; CHECK-NEXT: adrp x0, :got:global | ||
| ; CHECK-NEXT: ldr x0, [x0, :got_lo12:global] | ||
| ; CHECK-NEXT: mov x1, #4 | ||
| ; CHECK-NEXT: b __emupac_pacda | ||
| ; CHECK-NEXT: .section .rodata | ||
| ; CHECK-NEXT: .xword [[FUNC]]@FUNCINIT | ||
| @globalref = constant ptr ptrauth (ptr @global, i32 2, i64 4, ptr null), align 8 | ||
|
|
||
| ; CHECK: globalref8: | ||
| ; CHECK-NEXT: [[PLACE:.*]]: | ||
| ; CHECK-NEXT: .section .text.startup | ||
| ; CHECK-NEXT: [[FUNC:.*]]: | ||
| ; CHECK-NEXT: adrp x0, :got:global | ||
| ; CHECK-NEXT: ldr x0, [x0, :got_lo12:global] | ||
| ; CHECK-NEXT: add x0, x0, #8 | ||
| ; CHECK-NEXT: mov x1, #5 | ||
| ; CHECK-NEXT: b __emupac_pacda | ||
| ; CHECK-NEXT: .section .rodata | ||
| ; CHECK-NEXT: .xword [[FUNC]]@FUNCINIT | ||
| @globalref8 = constant ptr ptrauth (ptr getelementptr (i8, ptr @global, i64 8), i32 2, i64 5, ptr null), align 8 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| ; RUN: llc -mtriple aarch64-linux-gnu -mattr=+pauth -filetype=asm -o - %s | FileCheck --check-prefix=ELF %s | ||
| ; RUN: llc -mtriple aarch64-linux-musl -mattr=+pauth -filetype=asm -o - %s | FileCheck --check-prefix=ELF %s | ||
|
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. why is this needed? shouldn't the codegen for things that didn't need IRELATIVE before stay the same?
Contributor
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. That's needed because glibc doesn't support the PAuth relocations (so it uses IRELATIVE after this change), so I needed to switch to another triple that does.
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. Clarified with Peter: before, this generated PAuth relocations for glibc, even though that wouldn't actually work. |
||
| ; RUN: llc -mtriple aarch64-apple-darwin -mattr=+pauth -filetype=asm -o - %s | FileCheck --check-prefix=MACHO %s | ||
|
|
||
| ; ELF-LABEL: _ZTI10Disc: | ||
|
|
||
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.
maybe for posterity add a comment of the way codegen in the different cases?
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.
Done