5
5
; RUN: llvm-readelf -r -x.got %t | FileCheck %s
6
6
7
7
; CHECK: Relocation section '.rela.dyn' at offset 0x3d0 contains 8 entries:
8
- ; CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
9
- ; CHECK-NEXT: {{(0{8})}}[[OFFSET1:([[:xdigit:]]{8})]] 0000000100000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 func_undef + 0
10
- ; CHECK-NEXT: {{([[:xdigit:]]{16})}} 0000000200000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g1 + 0
11
- ; CHECK-NEXT: {{(0{8})}}[[OFFSET2:([[:xdigit:]]{8})]] 0000000300000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g2 + 0
12
- ; CHECK-NEXT: {{([[:xdigit:]]{16})}} 0000000400000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g3 + 0
13
- ; CHECK-NEXT: {{(0{8})}}[[OFFSET3:([[:xdigit:]]{8})]] 0000000500000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g4 + 0
14
- ; CHECK-NEXT: {{([[:xdigit:]]{16})}} 0000000600000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 var_undef + 0
15
- ; CHECK-NEXT: {{(0{8})}}[[OFFSET4:([[:xdigit:]]{8})]] 0000000700000412 R_AARCH64_AUTH_GLOB_DAT {{([[:xdigit:]]{16})}} func + 0
16
- ; CHECK-NEXT: {{([[:xdigit:]]{16})}} 0000000a00000412 R_AARCH64_AUTH_GLOB_DAT {{([[:xdigit:]]{16})}} var + 0
8
+ ; CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
9
+ ; CHECK-NEXT: 00000000000210b8 0000000100000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 func_undef + 0
10
+ ; CHECK-NEXT: 00000000000210c0 0000000200000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g1 + 0
11
+ ; CHECK-NEXT: 00000000000210c8 0000000300000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g2 + 0
12
+ ; CHECK-NEXT: 00000000000210d0 0000000400000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g3 + 0
13
+ ; CHECK-NEXT: 00000000000210d8 0000000500000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 g4 + 0
14
+ ; CHECK-NEXT: 00000000000210e0 0000000600000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 var_undef + 0
15
+ ; CHECK-NEXT: 00000000000210a8 0000000700000412 R_AARCH64_AUTH_GLOB_DAT 0000000000010800 func + 0
16
+ ; CHECK-NEXT: 00000000000210b0 0000000a00000412 R_AARCH64_AUTH_GLOB_DAT 0000000000031400 var + 0
17
17
18
18
; CHECK: Hex dump of section '.got':
19
- ; CHECK-NEXT: 0x{{0*}}[[OFFSET4]] 00000000 00000080 00000000 000000a0
20
- ;; ^^ func: 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
21
- ;; ^^ var: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
22
- ; CHECK-NEXT: 0x{{0*}}[[OFFSET1]] 00000000 00000080 00000000 000000a0
23
- ;; ^^ func_undef: 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
24
- ;; ^^ g1: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
25
- ; CHECK-NEXT: 0x{{0*}}[[OFFSET2]] 00000000 000000a0 00000000 000000a0
26
- ;; ^^ g2: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
27
- ;; ^^ g3: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
28
- ; CHECK-NEXT: 0x{{0*}}[[OFFSET3]] 00000000 000000a0 00000000 000000a0
29
- ;; ^^ g4: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
30
- ;; ^^ var_undef: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
19
+ ; CHECK-NEXT: 0x000210a8 00000000 00000080 00000000 000000a0
20
+ ;; ^^ func: 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
21
+ ;; ^^ var: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
22
+ ; CHECK-NEXT: 0x000210b8 00000000 00000080 00000000 000000a0
23
+ ;; ^^ func_undef: 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
24
+ ;; ^^ g1: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
25
+ ; CHECK-NEXT: 0x000210c8 00000000 000000a0 00000000 000000a0
26
+ ;; ^^ g2: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
27
+ ;; ^^ g3: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
28
+ ; CHECK-NEXT: 0x000210d8 00000000 000000a0 00000000 000000a0
29
+ ;; ^^ g4: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
30
+ ;; ^^ var_undef: 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
31
31
32
32
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
33
33
target triple = "aarch64-unknown-linux-gnu"
@@ -37,16 +37,26 @@ target triple = "aarch64-unknown-linux-gnu"
37
37
@g3 = external global ptr
38
38
@g4 = external global ptr
39
39
40
- define void @func () {
40
+ ; Minor codegen changes may influence function sizes and thus move subsequent
41
+ ; symbols. To prevent accidental changes to symbol addresses, request an
42
+ ; alignment that is larger than any expected function's size.
43
+ ;
44
+ ; Note that it is handy to have a trivial function like _start at the end of
45
+ ; the .text section, as most offsets of interest point to the dynamic section,
46
+ ; and one cannot easily control its alignment. On the other hand, the _start
47
+ ; function almost certainly contains a single ret instruction and is itself
48
+ ; aligned, making offsets of the subsequent sections predictable.
49
+
50
+ define void @func () align 1024 {
41
51
entry:
42
52
ret void
43
53
}
44
54
declare void @func_undef ()
45
55
46
- @var = global i32 42
56
+ @var = global i32 42 , align 1024
47
57
@var_undef = external global i32
48
58
49
- define void @bar () #0 {
59
+ define void @bar () #0 align 1024 {
50
60
entry:
51
61
store ptr ptr auth (ptr @func , i32 0 ), ptr @g1
52
62
store ptr ptr auth (ptr @func_undef , i32 0 ), ptr @g2
55
65
ret void
56
66
}
57
67
58
- define void @_start () {
68
+ define void @_start () align 1024 {
59
69
entry:
60
70
ret void
61
71
}
0 commit comments