-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[lld][test][PAC] Do not rely on concrete offsets in LTO tests #143358
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
4d322b5
e2063ce
e283f6d
5dbfbff
9d94626
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 |
|---|---|---|
|
|
@@ -6,26 +6,26 @@ | |
|
|
||
| ; CHECK: Relocation section '.rela.dyn' at offset 0x3d0 contains 8 entries: | ||
| ; CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend | ||
| ; CHECK-NEXT: 00000000000206a0 0000000100000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 func_undef + 0 | ||
| ; CHECK-NEXT: 00000000000206a8 0000000200000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g1 + 0 | ||
| ; CHECK-NEXT: 00000000000206b0 0000000300000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g2 + 0 | ||
| ; CHECK-NEXT: 00000000000206b8 0000000400000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g3 + 0 | ||
| ; CHECK-NEXT: 00000000000206c0 0000000500000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g4 + 0 | ||
| ; CHECK-NEXT: 00000000000206c8 0000000600000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 var_undef + 0 | ||
| ; CHECK-NEXT: 0000000000020690 0000000700000412 R_AARCH64_AUTH_GLOB_DAT 0000000000010490 func + 0 | ||
| ; CHECK-NEXT: 0000000000020698 0000000a00000412 R_AARCH64_AUTH_GLOB_DAT 00000000000306d0 var + 0 | ||
| ; CHECK-NEXT: 00000000000210b8 0000000100000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 func_undef + 0 | ||
| ; CHECK-NEXT: 00000000000210c0 0000000200000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g1 + 0 | ||
| ; CHECK-NEXT: 00000000000210c8 0000000300000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g2 + 0 | ||
| ; CHECK-NEXT: 00000000000210d0 0000000400000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g3 + 0 | ||
| ; CHECK-NEXT: 00000000000210d8 0000000500000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g4 + 0 | ||
| ; CHECK-NEXT: 00000000000210e0 0000000600000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 var_undef + 0 | ||
| ; CHECK-NEXT: 00000000000210a8 0000000700000412 R_AARCH64_AUTH_GLOB_DAT 0000000000010800 func + 0 | ||
| ; CHECK-NEXT: 00000000000210b0 0000000a00000412 R_AARCH64_AUTH_GLOB_DAT 0000000000031400 var + 0 | ||
|
|
||
| ; CHECK: Hex dump of section '.got': | ||
| ; CHECK-NEXT: 0x00020690 00000000 00000080 00000000 000000a0 | ||
| ; CHECK-NEXT: 0x000210a8 00000000 00000080 00000000 000000a0 | ||
| ;; ^^ func: 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA | ||
| ;; ^^ var: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA | ||
| ; CHECK-NEXT: 0x000206a0 00000000 00000080 00000000 000000a0 | ||
| ; CHECK-NEXT: 0x000210b8 00000000 00000080 00000000 000000a0 | ||
| ;; ^^ func_undef: 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA | ||
| ;; ^^ g1: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA | ||
| ; CHECK-NEXT: 0x000206b0 00000000 000000a0 00000000 000000a0 | ||
| ; CHECK-NEXT: 0x000210c8 00000000 000000a0 00000000 000000a0 | ||
| ;; ^^ g2: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA | ||
| ;; ^^ g3: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA | ||
| ; CHECK-NEXT: 0x000206c0 00000000 000000a0 00000000 000000a0 | ||
| ; CHECK-NEXT: 0x000210d8 00000000 000000a0 00000000 000000a0 | ||
| ;; ^^ g4: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA | ||
| ;; ^^ var_undef: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA | ||
|
|
||
|
|
@@ -37,16 +37,26 @@ target triple = "aarch64-unknown-linux-gnu" | |
| @g3 = external global ptr | ||
| @g4 = external global ptr | ||
|
|
||
| define void @func() { | ||
| ; Minor codegen changes may influence function sizes and thus move subsequent | ||
| ; symbols. To prevent accidental changes to symbol addresses, request an | ||
| ; alignment that is larger than any expected function's size. | ||
| ; | ||
| ; Note that it is handy to have a trivial function like _start at the end of | ||
| ; the .text section, as most offsets of interest point to the dynamic section, | ||
| ; and one cannot easily control its alignment. On the other hand, the _start | ||
| ; function almost certainly contains a single ret instruction and is itself | ||
| ; aligned, making offsets of the subsequent sections predictable. | ||
|
||
|
|
||
| define void @func() align 1024 { | ||
| entry: | ||
| ret void | ||
| } | ||
| declare void @func_undef() | ||
|
|
||
| @var = global i32 42 | ||
| @var = global i32 42, align 1024 | ||
| @var_undef = external global i32 | ||
|
|
||
| define void @bar() #0 { | ||
| define void @bar() #0 align 1024 { | ||
| entry: | ||
| store ptr ptrauth (ptr @func, i32 0), ptr @g1 | ||
| store ptr ptrauth (ptr @func_undef, i32 0), ptr @g2 | ||
|
|
@@ -55,7 +65,7 @@ entry: | |
| ret void | ||
| } | ||
|
|
||
| define void @_start() { | ||
| define void @_start() align 1024 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
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.
Can use
so that the next time we change addresses, we only need to change one line.
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.
Thanks! Applied your suggestion in 5dbfbff