1 RUN: llvm-readobj -r %p/Inputs/trivial.obj.coff-i386 \
2 RUN: | FileCheck %s -check-prefix COFF
3 RUN: llvm-readobj -r %p/Inputs/bad-relocs.obj.coff-i386 \
4 RUN: | FileCheck %s -check-prefix BAD-COFF-RELOCS
5 RUN: llvm-readobj -r %p/Inputs/relocs-no-symtab.obj.coff-i386 \
6 RUN: | FileCheck %s -check-prefix BAD-COFF-RELOCS
7 RUN: llvm-readobj -r %p/Inputs/trivial.obj.elf-i386 \
8 RUN: | FileCheck %s -check-prefix ELF
9 RUN: llvm-readobj -r %p/Inputs/trivial.obj.macho-i386 \
10 RUN: | FileCheck %s -check-prefix MACHO-I386
11 RUN: llvm-readobj -r %p/Inputs/trivial.obj.macho-x86-64 \
12 RUN: | FileCheck %s -check-prefix MACHO-X86-64
13 RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.macho-ppc \
14 RUN: | FileCheck %s -check-prefix MACHO-PPC
15 RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.macho-ppc64 \
16 RUN: | FileCheck %s -check-prefix MACHO-PPC64
17 RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.macho-arm \
18 RUN: | FileCheck %s -check-prefix MACHO-ARM
19 RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.wasm \
20 RUN: | FileCheck %s -check-prefix WASM
23 COFF-NEXT: Section (1) .text {
24 COFF-NEXT: 0x4 IMAGE_REL_I386_DIR32 .data (4)
25 COFF-NEXT: 0x9 IMAGE_REL_I386_REL32 _puts (7)
26 COFF-NEXT: 0xE IMAGE_REL_I386_REL32 _SomeOtherFunction (8)
30 BAD-COFF-RELOCS: Relocations [
31 BAD-COFF-RELOCS-NEXT: Section (1) sec {
32 BAD-COFF-RELOCS-NEXT: 0xDEADBEEF IMAGE_REL_I386_ABSOLUTE -
33 BAD-COFF-RELOCS-NEXT: }
34 BAD-COFF-RELOCS-NEXT: ]
37 ELF-NEXT: Section (2) .rel.text {
38 ELF-NEXT: 0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0
39 ELF-NEXT: 0x12 R_386_GOTOFF .L.str 0x0
40 ELF-NEXT: 0x1A R_386_PLT32 puts 0x0
41 ELF-NEXT: 0x1F R_386_PLT32 SomeOtherFunction 0x0
45 MACHO-I386: Relocations [
46 MACHO-I386-NEXT: Section __text {
47 MACHO-I386-NEXT: 0x18 1 2 1 GENERIC_RELOC_VANILLA 0 _SomeOtherFunction
48 MACHO-I386-NEXT: 0x13 1 2 1 GENERIC_RELOC_VANILLA 0 _puts
49 MACHO-I386-NEXT: 0xB 0 2 n/a GENERIC_RELOC_LOCAL_SECTDIFF 1 0x22
50 MACHO-I386-NEXT: 0x0 0 2 n/a GENERIC_RELOC_PAIR 1 0x8
54 MACHO-X86-64: Relocations [
55 MACHO-X86-64-NEXT: Section __text {
56 MACHO-X86-64-NEXT: 0xE 1 2 1 X86_64_RELOC_BRANCH 0 _SomeOtherFunction
57 MACHO-X86-64-NEXT: 0x9 1 2 1 X86_64_RELOC_BRANCH 0 _puts
58 MACHO-X86-64-NEXT: 0x4 1 2 1 X86_64_RELOC_SIGNED 0 L_.str
62 MACHO-PPC: Relocations [
63 MACHO-PPC-NEXT: Section __text {
64 MACHO-PPC-NEXT: Relocation {
65 MACHO-PPC-NEXT: Offset: 0x24
66 MACHO-PPC-NEXT: PCRel: 0
67 MACHO-PPC-NEXT: Length: 2
68 MACHO-PPC-NEXT: Type: PPC_RELOC_LO16_SECTDIFF (11)
69 MACHO-PPC-NEXT: Value: 0x64
71 MACHO-PPC-NEXT: Relocation {
72 MACHO-PPC-NEXT: Offset: 0x0
73 MACHO-PPC-NEXT: PCRel: 0
74 MACHO-PPC-NEXT: Length: 2
75 MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1)
76 MACHO-PPC-NEXT: Value: 0xC
78 MACHO-PPC-NEXT: Relocation {
79 MACHO-PPC-NEXT: Offset: 0x1C
80 MACHO-PPC-NEXT: PCRel: 0
81 MACHO-PPC-NEXT: Length: 2
82 MACHO-PPC-NEXT: Type: PPC_RELOC_HA16_SECTDIFF (12)
83 MACHO-PPC-NEXT: Value: 0x64
85 MACHO-PPC-NEXT: Relocation {
86 MACHO-PPC-NEXT: Offset: 0x58
87 MACHO-PPC-NEXT: PCRel: 0
88 MACHO-PPC-NEXT: Length: 2
89 MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1)
90 MACHO-PPC-NEXT: Value: 0xC
92 MACHO-PPC-NEXT: Relocation {
93 MACHO-PPC-NEXT: Offset: 0x18
94 MACHO-PPC-NEXT: PCRel: 1
95 MACHO-PPC-NEXT: Length: 2
96 MACHO-PPC-NEXT: Type: PPC_RELOC_BR24 (3)
97 MACHO-PPC-NEXT: Section: __picsymbolstub1 (2)
100 MACHO-PPC-NEXT: Section __picsymbolstub1 {
101 MACHO-PPC-NEXT: Relocation {
102 MACHO-PPC-NEXT: Offset: 0x14
103 MACHO-PPC-NEXT: PCRel: 0
104 MACHO-PPC-NEXT: Length: 2
105 MACHO-PPC-NEXT: Type: PPC_RELOC_LO16_SECTDIFF (11)
106 MACHO-PPC-NEXT: Value: 0x68
108 MACHO-PPC-NEXT: Relocation {
109 MACHO-PPC-NEXT: Offset: 0x0
110 MACHO-PPC-NEXT: PCRel: 0
111 MACHO-PPC-NEXT: Length: 2
112 MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1)
113 MACHO-PPC-NEXT: Value: 0x48
115 MACHO-PPC-NEXT: Relocation {
116 MACHO-PPC-NEXT: Offset: 0xC
117 MACHO-PPC-NEXT: PCRel: 0
118 MACHO-PPC-NEXT: Length: 2
119 MACHO-PPC-NEXT: Type: PPC_RELOC_HA16_SECTDIFF (12)
120 MACHO-PPC-NEXT: Value: 0x68
122 MACHO-PPC-NEXT: Relocation {
123 MACHO-PPC-NEXT: Offset: 0x20
124 MACHO-PPC-NEXT: PCRel: 0
125 MACHO-PPC-NEXT: Length: 2
126 MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1)
127 MACHO-PPC-NEXT: Value: 0x48
130 MACHO-PPC-NEXT: Section __la_symbol_ptr {
131 MACHO-PPC-NEXT: Relocation {
132 MACHO-PPC-NEXT: Offset: 0x0
133 MACHO-PPC-NEXT: PCRel: 0
134 MACHO-PPC-NEXT: Length: 2
135 MACHO-PPC-NEXT: Type: PPC_RELOC_VANILLA (0)
136 MACHO-PPC-NEXT: Symbol: dyld_stub_binding_helper (5)
141 MACHO-PPC64: Relocations [
142 MACHO-PPC64-NEXT: Section __text {
143 MACHO-PPC64-NEXT: Relocation {
144 MACHO-PPC64-NEXT: Offset: 0x24
145 MACHO-PPC64-NEXT: PCRel: 0
146 MACHO-PPC64-NEXT: Length: 2
147 MACHO-PPC64-NEXT: Type: (14)
148 MACHO-PPC64-NEXT: Value: 0x64
150 MACHO-PPC64-NEXT: Relocation {
151 MACHO-PPC64-NEXT: Offset: 0x0
152 MACHO-PPC64-NEXT: PCRel: 0
153 MACHO-PPC64-NEXT: Length: 2
154 MACHO-PPC64-NEXT: Type: (1)
155 MACHO-PPC64-NEXT: Value: 0xC
157 MACHO-PPC64-NEXT: Relocation {
158 MACHO-PPC64-NEXT: Offset: 0x1C
159 MACHO-PPC64-NEXT: PCRel: 0
160 MACHO-PPC64-NEXT: Length: 2
161 MACHO-PPC64-NEXT: Type: (12)
162 MACHO-PPC64-NEXT: Value: 0x64
164 MACHO-PPC64-NEXT: Relocation {
165 MACHO-PPC64-NEXT: Offset: 0x58
166 MACHO-PPC64-NEXT: PCRel: 0
167 MACHO-PPC64-NEXT: Length: 2
168 MACHO-PPC64-NEXT: Type: (1)
169 MACHO-PPC64-NEXT: Value: 0xC
171 MACHO-PPC64-NEXT: Relocation {
172 MACHO-PPC64-NEXT: Offset: 0x18
173 MACHO-PPC64-NEXT: PCRel: 1
174 MACHO-PPC64-NEXT: Length: 2
175 MACHO-PPC64-NEXT: Type: (3)
176 MACHO-PPC64-NEXT: Section: __picsymbolstub1 (2)
179 MACHO-PPC64-NEXT: Section __picsymbolstub1 {
180 MACHO-PPC64-NEXT: Relocation {
181 MACHO-PPC64-NEXT: Offset: 0x14
182 MACHO-PPC64-NEXT: PCRel: 0
183 MACHO-PPC64-NEXT: Length: 2
184 MACHO-PPC64-NEXT: Type: (14)
185 MACHO-PPC64-NEXT: Value: 0x6C
187 MACHO-PPC64-NEXT: Relocation {
188 MACHO-PPC64-NEXT: Offset: 0x0
189 MACHO-PPC64-NEXT: PCRel: 0
190 MACHO-PPC64-NEXT: Length: 2
191 MACHO-PPC64-NEXT: Type: (1)
192 MACHO-PPC64-NEXT: Value: 0x48
194 MACHO-PPC64-NEXT: Relocation {
195 MACHO-PPC64-NEXT: Offset: 0xC
196 MACHO-PPC64-NEXT: PCRel: 0
197 MACHO-PPC64-NEXT: Length: 2
198 MACHO-PPC64-NEXT: Type: (12)
199 MACHO-PPC64-NEXT: Value: 0x6C
201 MACHO-PPC64-NEXT: Relocation {
202 MACHO-PPC64-NEXT: Offset: 0x24
203 MACHO-PPC64-NEXT: PCRel: 0
204 MACHO-PPC64-NEXT: Length: 2
205 MACHO-PPC64-NEXT: Type: (1)
206 MACHO-PPC64-NEXT: Value: 0x48
209 MACHO-PPC64-NEXT: Section __la_symbol_ptr {
210 MACHO-PPC64-NEXT: Relocation {
211 MACHO-PPC64-NEXT: Offset: 0x0
212 MACHO-PPC64-NEXT: PCRel: 0
213 MACHO-PPC64-NEXT: Length: 3
214 MACHO-PPC64-NEXT: Type: (0)
215 MACHO-PPC64-NEXT: Symbol: dyld_stub_binding_helper (5)
221 MACHO-ARM: Relocations [
222 MACHO-ARM-NEXT: Section __text {
223 MACHO-ARM-NEXT: Relocation {
224 MACHO-ARM-NEXT: Offset: 0x38
225 MACHO-ARM-NEXT: PCRel: 0
226 MACHO-ARM-NEXT: Length: 2
227 MACHO-ARM-NEXT: Type: ARM_RELOC_SECTDIFF (2)
228 MACHO-ARM-NEXT: Value: 0x40
230 MACHO-ARM-NEXT: Relocation {
231 MACHO-ARM-NEXT: Offset: 0x0
232 MACHO-ARM-NEXT: PCRel: 0
233 MACHO-ARM-NEXT: Length: 2
234 MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1)
235 MACHO-ARM-NEXT: Value: 0x28
237 MACHO-ARM-NEXT: Relocation {
238 MACHO-ARM-NEXT: Offset: 0x20
239 MACHO-ARM-NEXT: PCRel: 1
240 MACHO-ARM-NEXT: Length: 2
241 MACHO-ARM-NEXT: Type: ARM_RELOC_BR24 (5)
242 MACHO-ARM-NEXT: Symbol: _g
244 MACHO-ARM-NEXT: Relocation {
245 MACHO-ARM-NEXT: Offset: 0x1C
246 MACHO-ARM-NEXT: PCRel: 0
247 MACHO-ARM-NEXT: Length: 1
248 MACHO-ARM-NEXT: Type: ARM_RELOC_HALF (8)
249 MACHO-ARM-NEXT: Symbol: _g
251 MACHO-ARM-NEXT: Relocation {
252 MACHO-ARM-NEXT: Offset: 0x0
253 MACHO-ARM-NEXT: PCRel: 0
254 MACHO-ARM-NEXT: Length: 1
255 MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1)
256 MACHO-ARM-NEXT: Section: -
258 MACHO-ARM-NEXT: Relocation {
259 MACHO-ARM-NEXT: Offset: 0x18
260 MACHO-ARM-NEXT: PCRel: 0
261 MACHO-ARM-NEXT: Length: 0
262 MACHO-ARM-NEXT: Type: ARM_RELOC_HALF (8)
263 MACHO-ARM-NEXT: Symbol: _g
265 MACHO-ARM-NEXT: Relocation {
266 MACHO-ARM-NEXT: Offset: 0x0
267 MACHO-ARM-NEXT: PCRel: 0
268 MACHO-ARM-NEXT: Length: 0
269 MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1)
270 MACHO-ARM-NEXT: Section: -
272 MACHO-ARM-NEXT: Relocation {
273 MACHO-ARM-NEXT: Offset: 0xC
274 MACHO-ARM-NEXT: PCRel: 0
275 MACHO-ARM-NEXT: Length: 2
276 MACHO-ARM-NEXT: Type: ARM_RELOC_SECTDIFF (2)
277 MACHO-ARM-NEXT: Value: 0x44
279 MACHO-ARM-NEXT: Relocation {
280 MACHO-ARM-NEXT: Offset: 0x0
281 MACHO-ARM-NEXT: PCRel: 0
282 MACHO-ARM-NEXT: Length: 2
283 MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1)
284 MACHO-ARM-NEXT: Value: 0x4
290 WASM-NEXT: Section (4) CODE {
291 WASM-NEXT: Relocation {
292 WASM-NEXT: Type: R_WASM_MEMORY_ADDR_SLEB (4)
293 WASM-NEXT: Offset: 0x4
294 WASM-NEXT: Symbol: .L.str
297 WASM-NEXT: Relocation {
298 WASM-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
299 WASM-NEXT: Offset: 0xA
300 WASM-NEXT: Symbol: puts
302 WASM-NEXT: Relocation {
303 WASM-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
304 WASM-NEXT: Offset: 0x11
305 WASM-NEXT: Symbol: .LSomeOtherFunction_bitcast
307 WASM-NEXT: Relocation {
308 WASM-NEXT: Type: R_WASM_FUNCTION_INDEX_LEB (0)
309 WASM-NEXT: Offset: 0x1E
310 WASM-NEXT: Symbol: SomeOtherFunction