-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[PAC][lld][AArch64][ELF] Support signed GOT #113815
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
126df11
[PAC][lld][AArch64][ELF] Support signed GOT
kovdan01 2295d26
Address review comments
kovdan01 b8d3c51
Use `##` for comments in tests
kovdan01 7f7c952
Use `Err(ctx)` instead of `fatal` and use `getLocation` in error message
kovdan01 6d2bfb1
Use aarch64 triple in tests
kovdan01 6d3b0d3
Switch to `printLocation` from `getLocation`
kovdan01 1e87943
Address review comments
kovdan01 b5b8ce9
Fix build after #118424
kovdan01 401c1e4
Change reloc codes in tests (see also #118214)
kovdan01 1078d05
Move pauth-specific code from `addGotEntry` to `addGotAuthEntry`
kovdan01 2c9a0f7
Add an assertion against unsupported signed irelative
kovdan01 81e4aff
Address review comments
kovdan01 afe0053
Do not try to add got entry after emitting error diagnostic
kovdan01 683249f
Do not use terms 'external' and 'local'
kovdan01 03f9115
Fix check prefixes
kovdan01 78cf14f
Do not specify output for error test cases
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
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
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
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
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,90 @@ | ||
# REQUIRES: aarch64 | ||
|
||
# RUN: rm -rf %t && split-file %s %t && cd %t | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=aarch64 %p/Inputs/shared.s -o a.o | ||
# RUN: ld.lld -shared a.o -o a.so | ||
|
||
#--- ok.s | ||
# RUN: llvm-mc -filetype=obj -triple=aarch64 ok.s -o ok.o | ||
|
||
# RUN: ld.lld ok.o a.so -pie -o ok1 | ||
# RUN: llvm-readelf -r -S -x .got ok1 | FileCheck %s --check-prefix=OK1 | ||
|
||
# RUN: ld.lld ok.o a.o -pie -o ok2 | ||
# RUN: llvm-readelf -r -S -x .got -s ok2 | FileCheck %s --check-prefix=OK2 | ||
|
||
# OK1: Offset Info Type Symbol's Value Symbol's Name + Addend | ||
# OK1-NEXT: 0000000000020380 0000000100000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 bar + 0 | ||
# OK1-NEXT: 0000000000020388 0000000200000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 zed + 0 | ||
|
||
## Symbol's values for bar and zed are equal since they contain no content (see Inputs/shared.s) | ||
# OK2: Offset Info Type Symbol's Value Symbol's Name + Addend | ||
# OK2-NEXT: 0000000000020320 0000000000000411 R_AARCH64_AUTH_RELATIVE 10260 | ||
# OK2-NEXT: 0000000000020328 0000000000000411 R_AARCH64_AUTH_RELATIVE 10260 | ||
|
||
# OK1: Hex dump of section '.got': | ||
# OK1-NEXT: 0x00020380 00000000 00000080 00000000 000000a0 | ||
## ^^ | ||
## 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA | ||
## ^^ | ||
## 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA | ||
|
||
# OK2: Symbol table '.symtab' contains {{.*}} entries: | ||
# OK2: Num: Value Size Type Bind Vis Ndx Name | ||
# OK2: 0000000000010260 0 FUNC GLOBAL DEFAULT 6 bar | ||
# OK2: 0000000000010260 0 NOTYPE GLOBAL DEFAULT 6 zed | ||
|
||
# OK2: Hex dump of section '.got': | ||
# OK2-NEXT: 0x00020320 00000000 00000080 00000000 000000a0 | ||
## ^^ | ||
## 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA | ||
## ^^ | ||
## 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA | ||
|
||
# RUN: llvm-objdump -d ok1 | FileCheck %s --check-prefix=OK1-ASM | ||
|
||
# OK1-ASM: <_start>: | ||
# OK1-ASM-NEXT: adrp x0, 0x20000 | ||
# OK1-ASM-NEXT: ldr x0, [x0, #0x380] | ||
# OK1-ASM-NEXT: adrp x1, 0x20000 | ||
# OK1-ASM-NEXT: add x1, x1, #0x380 | ||
# OK1-ASM-NEXT: adrp x0, 0x20000 | ||
# OK1-ASM-NEXT: ldr x0, [x0, #0x388] | ||
# OK1-ASM-NEXT: adrp x1, 0x20000 | ||
# OK1-ASM-NEXT: add x1, x1, #0x388 | ||
|
||
# RUN: llvm-objdump -d ok2 | FileCheck %s --check-prefix=OK2-ASM | ||
|
||
# OK2-ASM: <_start>: | ||
# OK2-ASM-NEXT: adrp x0, 0x20000 | ||
# OK2-ASM-NEXT: ldr x0, [x0, #0x320] | ||
# OK2-ASM-NEXT: adrp x1, 0x20000 | ||
# OK2-ASM-NEXT: add x1, x1, #0x320 | ||
# OK2-ASM-NEXT: adrp x0, 0x20000 | ||
# OK2-ASM-NEXT: ldr x0, [x0, #0x328] | ||
# OK2-ASM-NEXT: adrp x1, 0x20000 | ||
# OK2-ASM-NEXT: add x1, x1, #0x328 | ||
|
||
.globl _start | ||
_start: | ||
adrp x0, :got_auth:bar | ||
ldr x0, [x0, :got_auth_lo12:bar] | ||
adrp x1, :got_auth:bar | ||
add x1, x1, :got_auth_lo12:bar | ||
adrp x0, :got_auth:zed | ||
ldr x0, [x0, :got_auth_lo12:zed] | ||
adrp x1, :got_auth:zed | ||
add x1, x1, :got_auth_lo12:zed | ||
|
||
#--- err.s | ||
# RUN: llvm-mc -filetype=obj -triple=aarch64 err.s -o err.o | ||
# RUN: not ld.lld err.o a.so -pie 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error: | ||
# ERR: error: both AUTH and non-AUTH GOT entries for 'bar' requested, but only one type of GOT entry per symbol is supported | ||
|
||
.globl _start | ||
_start: | ||
adrp x0, :got_auth:bar | ||
ldr x0, [x0, :got_auth_lo12:bar] | ||
adrp x0, :got:bar | ||
ldr x0, [x0, :got_lo12:bar] |
Oops, something went wrong.
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.
with the
... split-file %s %t && cd %t
pattern, you can omit-o /dev/null
fornot ld.lld
commands.without
cd %t
,-o /dev/null
is needed so that we don't create a temporary file under CWD. Google's internal lit tester relies on this property, and it's generally a good idea to ensure that the tests run regardless of CWD.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.
Deleted explicit output specification in 78cf14f, thanks. Also applied to #113817