1 ## Test that llvm-readobj/llvm-readelf shows proper relocation type
2 ## names and values for x86_64 target.
4 # RUN: yaml2obj %s -o %t-x86_64.o
5 # RUN: llvm-readobj -r --expand-relocs %t-x86_64.o | FileCheck %s --check-prefix=LLVM
6 # RUN: llvm-readelf -r --expand-relocs %t-x86_64.o | FileCheck %s --check-prefix=GNU
8 # LLVM: Type: R_X86_64_NONE (0)
9 # LLVM: Type: R_X86_64_64 (1)
10 # LLVM: Type: R_X86_64_PC32 (2)
11 # LLVM: Type: R_X86_64_GOT32 (3)
12 # LLVM: Type: R_X86_64_PLT32 (4)
13 # LLVM: Type: R_X86_64_COPY (5)
14 # LLVM: Type: R_X86_64_GLOB_DAT (6)
15 # LLVM: Type: R_X86_64_JUMP_SLOT (7)
16 # LLVM: Type: R_X86_64_RELATIVE (8)
17 # LLVM: Type: R_X86_64_GOTPCREL (9)
18 # LLVM: Type: R_X86_64_32 (10)
19 # LLVM: Type: R_X86_64_32S (11)
20 # LLVM: Type: R_X86_64_16 (12)
21 # LLVM: Type: R_X86_64_PC16 (13)
22 # LLVM: Type: R_X86_64_8 (14)
23 # LLVM: Type: R_X86_64_PC8 (15)
24 # LLVM: Type: R_X86_64_DTPMOD64 (16)
25 # LLVM: Type: R_X86_64_DTPOFF64 (17)
26 # LLVM: Type: R_X86_64_TPOFF64 (18)
27 # LLVM: Type: R_X86_64_TLSGD (19)
28 # LLVM: Type: R_X86_64_TLSLD (20)
29 # LLVM: Type: R_X86_64_DTPOFF32 (21)
30 # LLVM: Type: R_X86_64_GOTTPOFF (22)
31 # LLVM: Type: R_X86_64_TPOFF32 (23)
32 # LLVM: Type: R_X86_64_PC64 (24)
33 # LLVM: Type: R_X86_64_GOTOFF64 (25)
34 # LLVM: Type: R_X86_64_GOTPC32 (26)
35 # LLVM: Type: R_X86_64_GOT64 (27)
36 # LLVM: Type: R_X86_64_GOTPCREL64 (28)
37 # LLVM: Type: R_X86_64_GOTPC64 (29)
38 # LLVM: Type: R_X86_64_GOTPLT64 (30)
39 # LLVM: Type: R_X86_64_PLTOFF64 (31)
40 # LLVM: Type: R_X86_64_SIZE32 (32)
41 # LLVM: Type: R_X86_64_SIZE64 (33)
42 # LLVM: Type: R_X86_64_GOTPC32_TLSDESC (34)
43 # LLVM: Type: R_X86_64_TLSDESC_CALL (35)
44 # LLVM: Type: R_X86_64_TLSDESC (36)
45 # LLVM: Type: R_X86_64_IRELATIVE (37)
46 # LLVM: Type: R_X86_64_GOTPCRELX (41)
47 # LLVM: Type: R_X86_64_REX_GOTPCRELX (42)
49 # GNU: Relocation section '.rela.text' at offset 0x48 contains 40 entries:
50 # GNU-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
51 # GNU-NEXT: 0000000000000003 0000000100000000 R_X86_64_NONE 0000000000000000 foo + 0
52 # GNU-NEXT: 000000000000000a 0000000100000001 R_X86_64_64 0000000000000000 foo + 0
53 # GNU-NEXT: 0000000000000011 0000000100000002 R_X86_64_PC32 0000000000000000 foo + 0
54 # GNU-NEXT: 0000000000000018 0000000100000003 R_X86_64_GOT32 0000000000000000 foo + 0
55 # GNU-NEXT: 000000000000001f 0000000100000004 R_X86_64_PLT32 0000000000000000 foo + 0
56 # GNU-NEXT: 0000000000000026 0000000100000005 R_X86_64_COPY 0000000000000000 foo + 0
57 # GNU-NEXT: 000000000000002d 0000000100000006 R_X86_64_GLOB_DAT 0000000000000000 foo + 0
58 # GNU-NEXT: 0000000000000034 0000000100000007 R_X86_64_JUMP_SLOT 0000000000000000 foo + 0
59 # GNU-NEXT: 000000000000003b 0000000100000008 R_X86_64_RELATIVE 0000000000000000 foo + 0
60 # GNU-NEXT: 0000000000000042 0000000100000009 R_X86_64_GOTPCREL 0000000000000000 foo + 0
61 # GNU-NEXT: 0000000000000049 000000010000000a R_X86_64_32 0000000000000000 foo + 0
62 # GNU-NEXT: 0000000000000050 000000010000000b R_X86_64_32S 0000000000000000 foo + 0
63 # GNU-NEXT: 0000000000000057 000000010000000c R_X86_64_16 0000000000000000 foo + 0
64 # GNU-NEXT: 000000000000005e 000000010000000d R_X86_64_PC16 0000000000000000 foo + 0
65 # GNU-NEXT: 0000000000000065 000000010000000e R_X86_64_8 0000000000000000 foo + 0
66 # GNU-NEXT: 000000000000006c 000000010000000f R_X86_64_PC8 0000000000000000 foo + 0
67 # GNU-NEXT: 0000000000000073 0000000100000010 R_X86_64_DTPMOD64 0000000000000000 foo + 0
68 # GNU-NEXT: 000000000000007a 0000000100000011 R_X86_64_DTPOFF64 0000000000000000 foo + 0
69 # GNU-NEXT: 0000000000000081 0000000100000012 R_X86_64_TPOFF64 0000000000000000 foo + 0
70 # GNU-NEXT: 0000000000000088 0000000100000013 R_X86_64_TLSGD 0000000000000000 foo + 0
71 # GNU-NEXT: 000000000000008f 0000000100000014 R_X86_64_TLSLD 0000000000000000 foo + 0
72 # GNU-NEXT: 0000000000000096 0000000100000015 R_X86_64_DTPOFF32 0000000000000000 foo + 0
73 # GNU-NEXT: 000000000000009d 0000000100000016 R_X86_64_GOTTPOFF 0000000000000000 foo + 0
74 # GNU-NEXT: 00000000000000a4 0000000100000017 R_X86_64_TPOFF32 0000000000000000 foo + 0
75 # GNU-NEXT: 00000000000000ab 0000000100000018 R_X86_64_PC64 0000000000000000 foo + 0
76 # GNU-NEXT: 00000000000000b2 0000000100000019 R_X86_64_GOTOFF64 0000000000000000 foo + 0
77 # GNU-NEXT: 00000000000000b9 000000010000001a R_X86_64_GOTPC32 0000000000000000 foo + 0
78 # GNU-NEXT: 00000000000000c0 000000010000001b R_X86_64_GOT64 0000000000000000 foo + 0
79 # GNU-NEXT: 00000000000000c7 000000010000001c R_X86_64_GOTPCREL64 0000000000000000 foo + 0
80 # GNU-NEXT: 00000000000000ce 000000010000001d R_X86_64_GOTPC64 0000000000000000 foo + 0
81 # GNU-NEXT: 00000000000000d5 000000010000001e R_X86_64_GOTPLT64 0000000000000000 foo + 0
82 # GNU-NEXT: 00000000000000dc 000000010000001f R_X86_64_PLTOFF64 0000000000000000 foo + 0
83 # GNU-NEXT: 00000000000000e3 0000000100000020 R_X86_64_SIZE32 0000000000000000 foo + 0
84 # GNU-NEXT: 00000000000000ea 0000000100000021 R_X86_64_SIZE64 0000000000000000 foo + 0
85 # GNU-NEXT: 00000000000000f1 0000000100000022 R_X86_64_GOTPC32_TLSDESC 0000000000000000 foo + 0
86 # GNU-NEXT: 00000000000000f8 0000000100000023 R_X86_64_TLSDESC_CALL 0000000000000000 foo + 0
87 # GNU-NEXT: 00000000000000ff 0000000100000024 R_X86_64_TLSDESC 0000000000000000 foo + 0
88 # GNU-NEXT: 0000000000000106 0000000100000025 R_X86_64_IRELATIVE 0000000000000000 foo + 0
89 # GNU-NEXT: 000000000000010a 0000000100000029 R_X86_64_GOTPCRELX 0000000000000000 foo + 0
90 # GNU-NEXT: 000000000000010e 000000010000002a R_X86_64_REX_GOTPCRELX 0000000000000000 foo + 0
106 AddressAlign: 0x0000000000000008
107 EntSize: 0x0000000000000018
110 - Offset: 0x0000000000000003
113 - Offset: 0x000000000000000A
116 - Offset: 0x0000000000000011
119 - Offset: 0x0000000000000018
122 - Offset: 0x000000000000001F
125 - Offset: 0x0000000000000026
128 - Offset: 0x000000000000002D
129 Type: R_X86_64_GLOB_DAT
131 - Offset: 0x0000000000000034
132 Type: R_X86_64_JUMP_SLOT
134 - Offset: 0x000000000000003B
135 Type: R_X86_64_RELATIVE
137 - Offset: 0x0000000000000042
138 Type: R_X86_64_GOTPCREL
140 - Offset: 0x0000000000000049
143 - Offset: 0x0000000000000050
146 - Offset: 0x0000000000000057
149 - Offset: 0x000000000000005E
152 - Offset: 0x0000000000000065
155 - Offset: 0x000000000000006C
158 - Offset: 0x0000000000000073
159 Type: R_X86_64_DTPMOD64
161 - Offset: 0x000000000000007A
162 Type: R_X86_64_DTPOFF64
164 - Offset: 0x0000000000000081
165 Type: R_X86_64_TPOFF64
167 - Offset: 0x0000000000000088
170 - Offset: 0x000000000000008F
173 - Offset: 0x0000000000000096
174 Type: R_X86_64_DTPOFF32
176 - Offset: 0x000000000000009D
177 Type: R_X86_64_GOTTPOFF
179 - Offset: 0x00000000000000A4
180 Type: R_X86_64_TPOFF32
182 - Offset: 0x00000000000000AB
185 - Offset: 0x00000000000000B2
186 Type: R_X86_64_GOTOFF64
188 - Offset: 0x00000000000000B9
189 Type: R_X86_64_GOTPC32
191 - Offset: 0x00000000000000C0
194 - Offset: 0x00000000000000C7
195 Type: R_X86_64_GOTPCREL64
197 - Offset: 0x00000000000000CE
198 Type: R_X86_64_GOTPC64
200 - Offset: 0x00000000000000D5
201 Type: R_X86_64_GOTPLT64
203 - Offset: 0x00000000000000DC
204 Type: R_X86_64_PLTOFF64
206 - Offset: 0x00000000000000E3
207 Type: R_X86_64_SIZE32
209 - Offset: 0x00000000000000EA
210 Type: R_X86_64_SIZE64
212 - Offset: 0x00000000000000F1
213 Type: R_X86_64_GOTPC32_TLSDESC
215 - Offset: 0x00000000000000F8
216 Type: R_X86_64_TLSDESC_CALL
218 - Offset: 0x00000000000000FF
219 Type: R_X86_64_TLSDESC
221 - Offset: 0x0000000000000106
222 Type: R_X86_64_IRELATIVE
224 - Offset: 0x000000000000010A
225 Type: R_X86_64_GOTPCRELX
227 - Offset: 0x000000000000010E
228 Type: R_X86_64_REX_GOTPCRELX