1 # RUN: yaml2obj %s -o %t
2 # RUN: llvm-objdump --macho --reloc %t | FileCheck %s --check-prefix=OBJDUMP-VERIFY
4 # OBJDUMP-VERIFY: Relocation information (__TEXT,__text) 4 entries
5 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
6 # OBJDUMP-VERIFY-NEXT: 00000018 False long True PAGOF12 False _w
7 # OBJDUMP-VERIFY-NEXT: 00000014 True long True PAGE21 False _w
8 # OBJDUMP-VERIFY-NEXT: 0000000c False long True PAGOF12 False _z
9 # OBJDUMP-VERIFY-NEXT: 00000008 True long True PAGE21 False _z
10 # OBJDUMP-VERIFY-NEXT: Relocation information (__TEXT,__StaticInit) 7 entries
11 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
12 # OBJDUMP-VERIFY-NEXT: 0000002c True long True BR26 False ___cxx_global_var_init
13 # OBJDUMP-VERIFY-NEXT: 00000018 False long True PAGOF12 False _w
14 # OBJDUMP-VERIFY-NEXT: 00000014 True long True PAGE21 False _w
15 # OBJDUMP-VERIFY-NEXT: 0000000c False long True PAGOF12 False _y
16 # OBJDUMP-VERIFY-NEXT: 00000008 True long True PAGE21 False _y
17 # OBJDUMP-VERIFY-NEXT: 00000004 False long True PAGOF12 False _x
18 # OBJDUMP-VERIFY-NEXT: 00000000 True long True PAGE21 False _x
19 # OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__data) 1 entries
20 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
21 # OBJDUMP-VERIFY-NEXT: 00000008 False ?( 3) True UNSIGND False _x
22 # OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__mod_init_func) 1 entries
23 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
24 # OBJDUMP-VERIFY-NEXT: 00000000 False ?( 3) True UNSIGND False __GLOBAL__sub_I_main.cpp
25 # OBJDUMP-VERIFY-NEXT: Relocation information (__LD,__compact_unwind) 3 entries
26 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
27 # OBJDUMP-VERIFY-NEXT: 00000040 False ?( 3) False UNSIGND False 2 (__TEXT,__StaticInit)
28 # OBJDUMP-VERIFY-NEXT: 00000020 False ?( 3) False UNSIGND False 1 (__TEXT,__text)
29 # OBJDUMP-VERIFY-NEXT: 00000000 False ?( 3) False UNSIGND False 2 (__TEXT,__StaticInit)
31 # RUN: obj2yaml %t | FileCheck %s
33 # CHECK-NEXT: - sectname: __text
34 # CHECK-NEXT: segname: __TEXT
35 # CHECK-NEXT: addr: 0x0
36 # CHECK-NEXT: size: 48
37 # CHECK-NEXT: offset: 0x2C0
38 # CHECK-NEXT: align: 2
39 # CHECK-NEXT: reloff: 0x3A0
40 # CHECK-NEXT: nreloc: 4
41 # CHECK-NEXT: flags: 0x80000400
42 # CHECK-NEXT: reserved1: 0x0
43 # CHECK-NEXT: reserved2: 0x0
44 # CHECK-NEXT: reserved3: 0x0
45 # CHECK-NEXT: content:
46 # CHECK-NEXT: relocations:
47 # CHECK-NEXT: - address: 0x18
48 # CHECK-NEXT: symbolnum: 9
49 # CHECK-NEXT: pcrel: false
50 # CHECK-NEXT: length: 2
51 # CHECK-NEXT: extern: true
53 # CHECK-NEXT: scattered: false
54 # CHECK-NEXT: value: 0
55 # CHECK-NEXT: - address: 0x14
56 # CHECK-NEXT: symbolnum: 9
57 # CHECK-NEXT: pcrel: true
58 # CHECK-NEXT: length: 2
59 # CHECK-NEXT: extern: true
61 # CHECK-NEXT: scattered: false
62 # CHECK-NEXT: value: 0
63 # CHECK-NEXT: - address: 0xC
64 # CHECK-NEXT: symbolnum: 12
65 # CHECK-NEXT: pcrel: false
66 # CHECK-NEXT: length: 2
67 # CHECK-NEXT: extern: true
69 # CHECK-NEXT: scattered: false
70 # CHECK-NEXT: value: 0
71 # CHECK-NEXT: - address: 0x8
72 # CHECK-NEXT: symbolnum: 12
73 # CHECK-NEXT: pcrel: true
74 # CHECK-NEXT: length: 2
75 # CHECK-NEXT: extern: true
77 # CHECK-NEXT: scattered: false
78 # CHECK-NEXT: value: 0
79 # CHECK-NEXT: - sectname: __StaticInit
80 # CHECK-NEXT: segname: __TEXT
81 # CHECK-NEXT: addr: 0x30
82 # CHECK-NEXT: size: 56
83 # CHECK-NEXT: offset: 0x2F0
84 # CHECK-NEXT: align: 2
85 # CHECK-NEXT: reloff: 0x3C0
86 # CHECK-NEXT: nreloc: 7
87 # CHECK-NEXT: flags: 0x80000400
88 # CHECK-NEXT: reserved1: 0x0
89 # CHECK-NEXT: reserved2: 0x0
90 # CHECK-NEXT: reserved3: 0x0
91 # CHECK-NEXT: content:
92 # CHECK-NEXT: relocations:
93 # CHECK-NEXT: - address: 0x2C
94 # CHECK-NEXT: symbolnum: 2
95 # CHECK-NEXT: pcrel: true
96 # CHECK-NEXT: length: 2
97 # CHECK-NEXT: extern: true
99 # CHECK-NEXT: scattered: false
100 # CHECK-NEXT: value: 0
101 # CHECK-NEXT: - address: 0x18
102 # CHECK-NEXT: symbolnum: 9
103 # CHECK-NEXT: pcrel: false
104 # CHECK-NEXT: length: 2
105 # CHECK-NEXT: extern: true
106 # CHECK-NEXT: type: 4
107 # CHECK-NEXT: scattered: false
108 # CHECK-NEXT: value: 0
109 # CHECK-NEXT: - address: 0x14
110 # CHECK-NEXT: symbolnum: 9
111 # CHECK-NEXT: pcrel: true
112 # CHECK-NEXT: length: 2
113 # CHECK-NEXT: extern: true
114 # CHECK-NEXT: type: 3
115 # CHECK-NEXT: scattered: false
116 # CHECK-NEXT: value: 0
117 # CHECK-NEXT: - address: 0xC
118 # CHECK-NEXT: symbolnum: 11
119 # CHECK-NEXT: pcrel: false
120 # CHECK-NEXT: length: 2
121 # CHECK-NEXT: extern: true
122 # CHECK-NEXT: type: 4
123 # CHECK-NEXT: scattered: false
124 # CHECK-NEXT: value: 0
125 # CHECK-NEXT: - address: 0x8
126 # CHECK-NEXT: symbolnum: 11
127 # CHECK-NEXT: pcrel: true
128 # CHECK-NEXT: length: 2
129 # CHECK-NEXT: extern: true
130 # CHECK-NEXT: type: 3
131 # CHECK-NEXT: scattered: false
132 # CHECK-NEXT: value: 0
133 # CHECK-NEXT: - address: 0x4
134 # CHECK-NEXT: symbolnum: 10
135 # CHECK-NEXT: pcrel: false
136 # CHECK-NEXT: length: 2
137 # CHECK-NEXT: extern: true
138 # CHECK-NEXT: type: 4
139 # CHECK-NEXT: scattered: false
140 # CHECK-NEXT: value: 0
141 # CHECK-NEXT: - address: 0x0
142 # CHECK-NEXT: symbolnum: 10
143 # CHECK-NEXT: pcrel: true
144 # CHECK-NEXT: length: 2
145 # CHECK-NEXT: extern: true
146 # CHECK-NEXT: type: 3
147 # CHECK-NEXT: scattered: false
148 # CHECK-NEXT: value: 0
149 # CHECK-NEXT: - sectname: __data
150 # CHECK-NEXT: segname: __DATA
151 # CHECK-NEXT: addr: 0x68
152 # CHECK-NEXT: size: 16
153 # CHECK-NEXT: offset: 0x328
154 # CHECK-NEXT: align: 3
155 # CHECK-NEXT: reloff: 0x3F8
156 # CHECK-NEXT: nreloc: 1
157 # CHECK-NEXT: flags: 0x0
158 # CHECK-NEXT: reserved1: 0x0
159 # CHECK-NEXT: reserved2: 0x0
160 # CHECK-NEXT: reserved3: 0x0
161 # CHECK-NEXT: content:
162 # CHECK-NEXT: relocations:
163 # CHECK-NEXT: - address: 0x8
164 # CHECK-NEXT: symbolnum: 10
165 # CHECK-NEXT: pcrel: false
166 # CHECK-NEXT: length: 3
167 # CHECK-NEXT: extern: true
168 # CHECK-NEXT: type: 0
169 # CHECK-NEXT: scattered: false
170 # CHECK-NEXT: value: 0
171 # CHECK-NEXT: - sectname: __common
172 # CHECK-NEXT: segname: __DATA
173 # CHECK-NEXT: addr: 0xE0
174 # CHECK-NEXT: size: 8
175 # CHECK-NEXT: offset: 0x0
176 # CHECK-NEXT: align: 3
177 # CHECK-NEXT: reloff: 0x0
178 # CHECK-NEXT: nreloc: 0
179 # CHECK-NEXT: flags: 0x1
180 # CHECK-NEXT: reserved1: 0x0
181 # CHECK-NEXT: reserved2: 0x0
182 # CHECK-NEXT: reserved3: 0x0
183 # CHECK-NEXT: - sectname: __mod_init_func
184 # CHECK-NEXT: segname: __DATA
185 # CHECK-NEXT: addr: 0x78
186 # CHECK-NEXT: size: 8
187 # CHECK-NEXT: offset: 0x338
188 # CHECK-NEXT: align: 3
189 # CHECK-NEXT: reloff: 0x400
190 # CHECK-NEXT: nreloc: 1
191 # CHECK-NEXT: flags: 0x9
192 # CHECK-NEXT: reserved1: 0x0
193 # CHECK-NEXT: reserved2: 0x0
194 # CHECK-NEXT: reserved3: 0x0
195 # CHECK-NEXT: content:
196 # CHECK-NEXT: relocations:
197 # CHECK-NEXT: - address: 0x0
198 # CHECK-NEXT: symbolnum: 3
199 # CHECK-NEXT: pcrel: false
200 # CHECK-NEXT: length: 3
201 # CHECK-NEXT: extern: true
202 # CHECK-NEXT: type: 0
203 # CHECK-NEXT: scattered: false
204 # CHECK-NEXT: value: 0
205 # CHECK-NEXT: - sectname: __compact_unwind
206 # CHECK-NEXT: segname: __LD
207 # CHECK-NEXT: addr: 0x80
208 # CHECK-NEXT: size: 96
209 # CHECK-NEXT: offset: 0x340
210 # CHECK-NEXT: align: 3
211 # CHECK-NEXT: reloff: 0x408
212 # CHECK-NEXT: nreloc: 3
213 # CHECK-NEXT: flags: 0x2000000
214 # CHECK-NEXT: reserved1: 0x0
215 # CHECK-NEXT: reserved2: 0x0
216 # CHECK-NEXT: reserved3: 0x0
217 # CHECK-NEXT: content:
218 # CHECK-NEXT: relocations:
219 # CHECK-NEXT: - address: 0x40
220 # CHECK-NEXT: symbolnum: 2
221 # CHECK-NEXT: pcrel: false
222 # CHECK-NEXT: length: 3
223 # CHECK-NEXT: extern: false
224 # CHECK-NEXT: type: 0
225 # CHECK-NEXT: scattered: false
226 # CHECK-NEXT: value: 0
227 # CHECK-NEXT: - address: 0x20
228 # CHECK-NEXT: symbolnum: 1
229 # CHECK-NEXT: pcrel: false
230 # CHECK-NEXT: length: 3
231 # CHECK-NEXT: extern: false
232 # CHECK-NEXT: type: 0
233 # CHECK-NEXT: scattered: false
234 # CHECK-NEXT: value: 0
235 # CHECK-NEXT: - address: 0x0
236 # CHECK-NEXT: symbolnum: 2
237 # CHECK-NEXT: pcrel: false
238 # CHECK-NEXT: length: 3
239 # CHECK-NEXT: extern: false
240 # CHECK-NEXT: type: 0
241 # CHECK-NEXT: scattered: false
242 # CHECK-NEXT: value: 0
248 cpusubtype: 0x00000000
269 addr: 0x0000000000000000
276 reserved1: 0x00000000
277 reserved2: 0x00000000
278 reserved3: 0x00000000
279 content: FF4300D1FF0F00B90800009008010091080140F90900009029010091290140F90801098BE00308AAFF430091C0035FD6
281 - address: 0x00000018
289 - address: 0x00000014
297 - address: 0x0000000C
305 - address: 0x00000008
313 - sectname: __StaticInit
315 addr: 0x0000000000000030
322 reserved1: 0x00000000
323 reserved2: 0x00000000
324 reserved3: 0x00000000
325 content: 08000090080100910900009029010091080109EB0900009029010091280100F9C0035FD6FD7BBFA9FD03009100000094FD7BC1A8C0035FD6
327 - address: 0x0000002C
335 - address: 0x00000018
343 - address: 0x00000014
351 - address: 0x0000000C
359 - address: 0x00000008
367 - address: 0x00000004
375 - address: 0x00000000
385 addr: 0x0000000000000068
392 reserved1: 0x00000000
393 reserved2: 0x00000000
394 reserved3: 0x00000000
395 content: '01000000020000000000000000000000'
397 - address: 0x00000008
407 addr: 0x00000000000000E0
414 reserved1: 0x00000000
415 reserved2: 0x00000000
416 reserved3: 0x00000000
417 - sectname: __mod_init_func
419 addr: 0x0000000000000078
426 reserved1: 0x00000000
427 reserved2: 0x00000000
428 reserved3: 0x00000000
429 content: '0000000000000000'
431 - address: 0x00000000
439 - sectname: __compact_unwind
441 addr: 0x0000000000000080
448 reserved1: 0x00000000
449 reserved2: 0x00000000
450 reserved3: 0x00000000
451 content: '300000000000000024000000000000020000000000000000000000000000000000000000000000003000000000100002000000000000000000000000000000005400000000000000140000000000000400000000000000000000000000000000'
453 - address: 0x00000040
461 - address: 0x00000020
469 - address: 0x00000000
477 - cmd: LC_VERSION_MIN_IPHONEOS
580 - ___cxx_global_var_init
581 - __GLOBAL__sub_I_main.cpp