1 ## Check how we print relocations.
3 # RUN: llvm-readobj -r %p/Inputs/trivial.obj.macho-i386 \
4 # RUN: | FileCheck %s --check-prefix MACHO-I386
5 # RUN: llvm-readobj -r %p/Inputs/trivial.obj.macho-x86-64 \
6 # RUN: | FileCheck %s --check-prefix MACHO-X86-64
7 # RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.macho-ppc \
8 # RUN: | FileCheck %s --check-prefix MACHO-PPC
9 # RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.macho-ppc64 \
10 # RUN: | FileCheck %s --check-prefix MACHO-PPC64
11 # RUN: llvm-readobj -r --expand-relocs %p/Inputs/trivial.obj.macho-arm \
12 # RUN: | FileCheck %s --check-prefix MACHO-ARM
14 # MACHO-I386: Relocations [
15 # MACHO-I386-NEXT: Section __text {
16 # MACHO-I386-NEXT: 0x18 1 2 1 GENERIC_RELOC_VANILLA 0 _SomeOtherFunction
17 # MACHO-I386-NEXT: 0x13 1 2 1 GENERIC_RELOC_VANILLA 0 _puts
18 # MACHO-I386-NEXT: 0xB 0 2 n/a GENERIC_RELOC_LOCAL_SECTDIFF 1 0x22
19 # MACHO-I386-NEXT: 0x0 0 2 n/a GENERIC_RELOC_PAIR 1 0x8
23 # MACHO-X86-64: Relocations [
24 # MACHO-X86-64-NEXT: Section __text {
25 # MACHO-X86-64-NEXT: 0xE 1 2 1 X86_64_RELOC_BRANCH 0 _SomeOtherFunction
26 # MACHO-X86-64-NEXT: 0x9 1 2 1 X86_64_RELOC_BRANCH 0 _puts
27 # MACHO-X86-64-NEXT: 0x4 1 2 1 X86_64_RELOC_SIGNED 0 L_.str
28 # MACHO-X86-64-NEXT: }
31 # MACHO-PPC: Relocations [
32 # MACHO-PPC-NEXT: Section __text {
33 # MACHO-PPC-NEXT: Relocation {
34 # MACHO-PPC-NEXT: Offset: 0x24
35 # MACHO-PPC-NEXT: PCRel: 0
36 # MACHO-PPC-NEXT: Length: 2
37 # MACHO-PPC-NEXT: Type: PPC_RELOC_LO16_SECTDIFF (11)
38 # MACHO-PPC-NEXT: Value: 0x64
40 # MACHO-PPC-NEXT: Relocation {
41 # MACHO-PPC-NEXT: Offset: 0x0
42 # MACHO-PPC-NEXT: PCRel: 0
43 # MACHO-PPC-NEXT: Length: 2
44 # MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1)
45 # MACHO-PPC-NEXT: Value: 0xC
47 # MACHO-PPC-NEXT: Relocation {
48 # MACHO-PPC-NEXT: Offset: 0x1C
49 # MACHO-PPC-NEXT: PCRel: 0
50 # MACHO-PPC-NEXT: Length: 2
51 # MACHO-PPC-NEXT: Type: PPC_RELOC_HA16_SECTDIFF (12)
52 # MACHO-PPC-NEXT: Value: 0x64
54 # MACHO-PPC-NEXT: Relocation {
55 # MACHO-PPC-NEXT: Offset: 0x58
56 # MACHO-PPC-NEXT: PCRel: 0
57 # MACHO-PPC-NEXT: Length: 2
58 # MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1)
59 # MACHO-PPC-NEXT: Value: 0xC
61 # MACHO-PPC-NEXT: Relocation {
62 # MACHO-PPC-NEXT: Offset: 0x18
63 # MACHO-PPC-NEXT: PCRel: 1
64 # MACHO-PPC-NEXT: Length: 2
65 # MACHO-PPC-NEXT: Type: PPC_RELOC_BR24 (3)
66 # MACHO-PPC-NEXT: Section: __picsymbolstub1 (2)
69 # MACHO-PPC-NEXT: Section __picsymbolstub1 {
70 # MACHO-PPC-NEXT: Relocation {
71 # MACHO-PPC-NEXT: Offset: 0x14
72 # MACHO-PPC-NEXT: PCRel: 0
73 # MACHO-PPC-NEXT: Length: 2
74 # MACHO-PPC-NEXT: Type: PPC_RELOC_LO16_SECTDIFF (11)
75 # MACHO-PPC-NEXT: Value: 0x68
77 # MACHO-PPC-NEXT: Relocation {
78 # MACHO-PPC-NEXT: Offset: 0x0
79 # MACHO-PPC-NEXT: PCRel: 0
80 # MACHO-PPC-NEXT: Length: 2
81 # MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1)
82 # MACHO-PPC-NEXT: Value: 0x48
84 # MACHO-PPC-NEXT: Relocation {
85 # MACHO-PPC-NEXT: Offset: 0xC
86 # MACHO-PPC-NEXT: PCRel: 0
87 # MACHO-PPC-NEXT: Length: 2
88 # MACHO-PPC-NEXT: Type: PPC_RELOC_HA16_SECTDIFF (12)
89 # MACHO-PPC-NEXT: Value: 0x68
91 # MACHO-PPC-NEXT: Relocation {
92 # MACHO-PPC-NEXT: Offset: 0x20
93 # MACHO-PPC-NEXT: PCRel: 0
94 # MACHO-PPC-NEXT: Length: 2
95 # MACHO-PPC-NEXT: Type: PPC_RELOC_PAIR (1)
96 # MACHO-PPC-NEXT: Value: 0x48
99 # MACHO-PPC-NEXT: Section __la_symbol_ptr {
100 # MACHO-PPC-NEXT: Relocation {
101 # MACHO-PPC-NEXT: Offset: 0x0
102 # MACHO-PPC-NEXT: PCRel: 0
103 # MACHO-PPC-NEXT: Length: 2
104 # MACHO-PPC-NEXT: Type: PPC_RELOC_VANILLA (0)
105 # MACHO-PPC-NEXT: Symbol: dyld_stub_binding_helper (5)
110 # MACHO-PPC64: Relocations [
111 # MACHO-PPC64-NEXT: Section __text {
112 # MACHO-PPC64-NEXT: Relocation {
113 # MACHO-PPC64-NEXT: Offset: 0x24
114 # MACHO-PPC64-NEXT: PCRel: 0
115 # MACHO-PPC64-NEXT: Length: 2
116 # MACHO-PPC64-NEXT: Type: (14)
117 # MACHO-PPC64-NEXT: Value: 0x64
118 # MACHO-PPC64-NEXT: }
119 # MACHO-PPC64-NEXT: Relocation {
120 # MACHO-PPC64-NEXT: Offset: 0x0
121 # MACHO-PPC64-NEXT: PCRel: 0
122 # MACHO-PPC64-NEXT: Length: 2
123 # MACHO-PPC64-NEXT: Type: (1)
124 # MACHO-PPC64-NEXT: Value: 0xC
125 # MACHO-PPC64-NEXT: }
126 # MACHO-PPC64-NEXT: Relocation {
127 # MACHO-PPC64-NEXT: Offset: 0x1C
128 # MACHO-PPC64-NEXT: PCRel: 0
129 # MACHO-PPC64-NEXT: Length: 2
130 # MACHO-PPC64-NEXT: Type: (12)
131 # MACHO-PPC64-NEXT: Value: 0x64
132 # MACHO-PPC64-NEXT: }
133 # MACHO-PPC64-NEXT: Relocation {
134 # MACHO-PPC64-NEXT: Offset: 0x58
135 # MACHO-PPC64-NEXT: PCRel: 0
136 # MACHO-PPC64-NEXT: Length: 2
137 # MACHO-PPC64-NEXT: Type: (1)
138 # MACHO-PPC64-NEXT: Value: 0xC
139 # MACHO-PPC64-NEXT: }
140 # MACHO-PPC64-NEXT: Relocation {
141 # MACHO-PPC64-NEXT: Offset: 0x18
142 # MACHO-PPC64-NEXT: PCRel: 1
143 # MACHO-PPC64-NEXT: Length: 2
144 # MACHO-PPC64-NEXT: Type: (3)
145 # MACHO-PPC64-NEXT: Section: __picsymbolstub1 (2)
146 # MACHO-PPC64-NEXT: }
147 # MACHO-PPC64-NEXT: }
148 # MACHO-PPC64-NEXT: Section __picsymbolstub1 {
149 # MACHO-PPC64-NEXT: Relocation {
150 # MACHO-PPC64-NEXT: Offset: 0x14
151 # MACHO-PPC64-NEXT: PCRel: 0
152 # MACHO-PPC64-NEXT: Length: 2
153 # MACHO-PPC64-NEXT: Type: (14)
154 # MACHO-PPC64-NEXT: Value: 0x6C
155 # MACHO-PPC64-NEXT: }
156 # MACHO-PPC64-NEXT: Relocation {
157 # MACHO-PPC64-NEXT: Offset: 0x0
158 # MACHO-PPC64-NEXT: PCRel: 0
159 # MACHO-PPC64-NEXT: Length: 2
160 # MACHO-PPC64-NEXT: Type: (1)
161 # MACHO-PPC64-NEXT: Value: 0x48
162 # MACHO-PPC64-NEXT: }
163 # MACHO-PPC64-NEXT: Relocation {
164 # MACHO-PPC64-NEXT: Offset: 0xC
165 # MACHO-PPC64-NEXT: PCRel: 0
166 # MACHO-PPC64-NEXT: Length: 2
167 # MACHO-PPC64-NEXT: Type: (12)
168 # MACHO-PPC64-NEXT: Value: 0x6C
169 # MACHO-PPC64-NEXT: }
170 # MACHO-PPC64-NEXT: Relocation {
171 # MACHO-PPC64-NEXT: Offset: 0x24
172 # MACHO-PPC64-NEXT: PCRel: 0
173 # MACHO-PPC64-NEXT: Length: 2
174 # MACHO-PPC64-NEXT: Type: (1)
175 # MACHO-PPC64-NEXT: Value: 0x48
176 # MACHO-PPC64-NEXT: }
177 # MACHO-PPC64-NEXT: }
178 # MACHO-PPC64-NEXT: Section __la_symbol_ptr {
179 # MACHO-PPC64-NEXT: Relocation {
180 # MACHO-PPC64-NEXT: Offset: 0x0
181 # MACHO-PPC64-NEXT: PCRel: 0
182 # MACHO-PPC64-NEXT: Length: 3
183 # MACHO-PPC64-NEXT: Type: (0)
184 # MACHO-PPC64-NEXT: Symbol: dyld_stub_binding_helper (5)
185 # MACHO-PPC64-NEXT: }
186 # MACHO-PPC64-NEXT: }
187 # MACHO-PPC64-NEXT: ]
189 # MACHO-ARM: Relocations [
190 # MACHO-ARM-NEXT: Section __text {
191 # MACHO-ARM-NEXT: Relocation {
192 # MACHO-ARM-NEXT: Offset: 0x38
193 # MACHO-ARM-NEXT: PCRel: 0
194 # MACHO-ARM-NEXT: Length: 2
195 # MACHO-ARM-NEXT: Type: ARM_RELOC_SECTDIFF (2)
196 # MACHO-ARM-NEXT: Value: 0x40
198 # MACHO-ARM-NEXT: Relocation {
199 # MACHO-ARM-NEXT: Offset: 0x0
200 # MACHO-ARM-NEXT: PCRel: 0
201 # MACHO-ARM-NEXT: Length: 2
202 # MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1)
203 # MACHO-ARM-NEXT: Value: 0x28
205 # MACHO-ARM-NEXT: Relocation {
206 # MACHO-ARM-NEXT: Offset: 0x20
207 # MACHO-ARM-NEXT: PCRel: 1
208 # MACHO-ARM-NEXT: Length: 2
209 # MACHO-ARM-NEXT: Type: ARM_RELOC_BR24 (5)
210 # MACHO-ARM-NEXT: Symbol: _g
212 # MACHO-ARM-NEXT: Relocation {
213 # MACHO-ARM-NEXT: Offset: 0x1C
214 # MACHO-ARM-NEXT: PCRel: 0
215 # MACHO-ARM-NEXT: Length: 1
216 # MACHO-ARM-NEXT: Type: ARM_RELOC_HALF (8)
217 # MACHO-ARM-NEXT: Symbol: _g
219 # MACHO-ARM-NEXT: Relocation {
220 # MACHO-ARM-NEXT: Offset: 0x0
221 # MACHO-ARM-NEXT: PCRel: 0
222 # MACHO-ARM-NEXT: Length: 1
223 # MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1)
224 # MACHO-ARM-NEXT: Section: -
226 # MACHO-ARM-NEXT: Relocation {
227 # MACHO-ARM-NEXT: Offset: 0x18
228 # MACHO-ARM-NEXT: PCRel: 0
229 # MACHO-ARM-NEXT: Length: 0
230 # MACHO-ARM-NEXT: Type: ARM_RELOC_HALF (8)
231 # MACHO-ARM-NEXT: Symbol: _g
233 # MACHO-ARM-NEXT: Relocation {
234 # MACHO-ARM-NEXT: Offset: 0x0
235 # MACHO-ARM-NEXT: PCRel: 0
236 # MACHO-ARM-NEXT: Length: 0
237 # MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1)
238 # MACHO-ARM-NEXT: Section: -
240 # MACHO-ARM-NEXT: Relocation {
241 # MACHO-ARM-NEXT: Offset: 0xC
242 # MACHO-ARM-NEXT: PCRel: 0
243 # MACHO-ARM-NEXT: Length: 2
244 # MACHO-ARM-NEXT: Type: ARM_RELOC_SECTDIFF (2)
245 # MACHO-ARM-NEXT: Value: 0x44
247 # MACHO-ARM-NEXT: Relocation {
248 # MACHO-ARM-NEXT: Offset: 0x0
249 # MACHO-ARM-NEXT: PCRel: 0
250 # MACHO-ARM-NEXT: Length: 2
251 # MACHO-ARM-NEXT: Type: ARM_RELOC_PAIR (1)
252 # MACHO-ARM-NEXT: Value: 0x4