Recommit "rL366894: [yaml2obj] - Allow custom fields for the SHT_UNDEF sections."
[llvm-complete.git] / test / tools / llvm-readobj / reloc-types-elf-x64.test
blob021fbb5d3d78c5deac78a687a66998a50ac430ca
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 0x1c8 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
92 --- !ELF
93 FileHeader:
94   Class:   ELFCLASS64
95   Data:    ELFDATA2LSB
96   OSABI:   ELFOSABI_GNU
97   Type:    ET_REL
98   Machine: EM_X86_64
99 Sections:
100   - Name:    .text
101     Type:    SHT_PROGBITS
102     Content: 00
103   - Name:         .rela.text
104     Type:         SHT_RELA
105     Link:         .symtab
106     AddressAlign: 0x0000000000000008
107     EntSize:      0x0000000000000018
108     Info:         .text
109     Relocations:
110       - Offset: 0x0000000000000003
111         Type:   R_X86_64_NONE
112         Symbol: foo
113       - Offset: 0x000000000000000A
114         Type:   R_X86_64_64
115         Symbol: foo
116       - Offset: 0x0000000000000011
117         Type:   R_X86_64_PC32
118         Symbol: foo
119       - Offset: 0x0000000000000018
120         Type:   R_X86_64_GOT32
121         Symbol: foo
122       - Offset: 0x000000000000001F
123         Type:   R_X86_64_PLT32
124         Symbol: foo
125       - Offset: 0x0000000000000026
126         Type:   R_X86_64_COPY
127         Symbol: foo
128       - Offset: 0x000000000000002D
129         Type:   R_X86_64_GLOB_DAT
130         Symbol: foo
131       - Offset: 0x0000000000000034
132         Type:   R_X86_64_JUMP_SLOT
133         Symbol: foo
134       - Offset: 0x000000000000003B
135         Type:   R_X86_64_RELATIVE
136         Symbol: foo
137       - Offset: 0x0000000000000042
138         Type:   R_X86_64_GOTPCREL
139         Symbol: foo
140       - Offset: 0x0000000000000049
141         Type:   R_X86_64_32
142         Symbol: foo
143       - Offset: 0x0000000000000050
144         Type:   R_X86_64_32S
145         Symbol: foo
146       - Offset: 0x0000000000000057
147         Type:   R_X86_64_16
148         Symbol: foo
149       - Offset: 0x000000000000005E
150         Type:   R_X86_64_PC16
151         Symbol: foo
152       - Offset: 0x0000000000000065
153         Type:   R_X86_64_8
154         Symbol: foo
155       - Offset: 0x000000000000006C
156         Type:   R_X86_64_PC8
157         Symbol: foo
158       - Offset: 0x0000000000000073
159         Type:   R_X86_64_DTPMOD64
160         Symbol: foo
161       - Offset: 0x000000000000007A
162         Type:   R_X86_64_DTPOFF64
163         Symbol: foo
164       - Offset: 0x0000000000000081
165         Type:   R_X86_64_TPOFF64
166         Symbol: foo
167       - Offset: 0x0000000000000088
168         Type:   R_X86_64_TLSGD
169         Symbol: foo
170       - Offset: 0x000000000000008F
171         Type:   R_X86_64_TLSLD
172         Symbol: foo
173       - Offset: 0x0000000000000096
174         Type:   R_X86_64_DTPOFF32
175         Symbol: foo
176       - Offset: 0x000000000000009D
177         Type:   R_X86_64_GOTTPOFF
178         Symbol: foo
179       - Offset: 0x00000000000000A4
180         Type:   R_X86_64_TPOFF32
181         Symbol: foo
182       - Offset: 0x00000000000000AB
183         Type:   R_X86_64_PC64
184         Symbol: foo
185       - Offset: 0x00000000000000B2
186         Type:   R_X86_64_GOTOFF64
187         Symbol: foo
188       - Offset: 0x00000000000000B9
189         Type:   R_X86_64_GOTPC32
190         Symbol: foo
191       - Offset: 0x00000000000000C0
192         Type:   R_X86_64_GOT64
193         Symbol: foo
194       - Offset: 0x00000000000000C7
195         Type:   R_X86_64_GOTPCREL64
196         Symbol: foo
197       - Offset: 0x00000000000000CE
198         Type:   R_X86_64_GOTPC64
199         Symbol: foo
200       - Offset: 0x00000000000000D5
201         Type:   R_X86_64_GOTPLT64
202         Symbol: foo
203       - Offset: 0x00000000000000DC
204         Type:   R_X86_64_PLTOFF64
205         Symbol: foo
206       - Offset: 0x00000000000000E3
207         Type:   R_X86_64_SIZE32
208         Symbol: foo
209       - Offset: 0x00000000000000EA
210         Type:   R_X86_64_SIZE64
211         Symbol: foo
212       - Offset: 0x00000000000000F1
213         Type:   R_X86_64_GOTPC32_TLSDESC
214         Symbol: foo
215       - Offset: 0x00000000000000F8
216         Type:   R_X86_64_TLSDESC_CALL
217         Symbol: foo
218       - Offset: 0x00000000000000FF
219         Type:   R_X86_64_TLSDESC
220         Symbol: foo
221       - Offset: 0x0000000000000106
222         Type:   R_X86_64_IRELATIVE
223         Symbol: foo
224       - Offset: 0x000000000000010A
225         Type:   R_X86_64_GOTPCRELX
226         Symbol: foo
227       - Offset: 0x000000000000010E
228         Type:   R_X86_64_REX_GOTPCRELX
229         Symbol: foo
230 Symbols:
231   - Name:    foo
232     Binding: STB_GLOBAL