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) 2 entries
5 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
6 # OBJDUMP-VERIFY-NEXT: 00000015 True long True SIGNED False _w
7 # OBJDUMP-VERIFY-NEXT: 0000000e True long True SIGNED False _z
8 # OBJDUMP-VERIFY-NEXT: Relocation information (__TEXT,__StaticInit) 4 entries
9 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
10 # OBJDUMP-VERIFY-NEXT: 00000025 True long True BRANCH False ___cxx_global_var_init
11 # OBJDUMP-VERIFY-NEXT: 00000018 True long True SIGNED False _w
12 # OBJDUMP-VERIFY-NEXT: 0000000e True long True SIGNED False _x
13 # OBJDUMP-VERIFY-NEXT: 00000007 True long True SIGNED False _y
14 # OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__data) 1 entries
15 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
16 # OBJDUMP-VERIFY-NEXT: 00000008 False quad True UNSIGND False _x
17 # OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__mod_init_func) 1 entries
18 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
19 # OBJDUMP-VERIFY-NEXT: 00000000 False quad True UNSIGND False __GLOBAL__sub_I_main.cpp
20 # OBJDUMP-VERIFY-NEXT: Relocation information (__LD,__compact_unwind) 3 entries
21 # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value
22 # OBJDUMP-VERIFY-NEXT: 00000040 False quad False UNSIGND False 2 (__TEXT,__StaticInit)
23 # OBJDUMP-VERIFY-NEXT: 00000020 False quad False UNSIGND False 1 (__TEXT,__text)
24 # OBJDUMP-VERIFY-NEXT: 00000000 False quad False UNSIGND False 2 (__TEXT,__StaticInit)
26 # RUN: obj2yaml %t | FileCheck %s
28 # CHECK-NEXT: - sectname: __text
29 # CHECK-NEXT: segname: __TEXT
30 # CHECK-NEXT: addr: 0x0
31 # CHECK-NEXT: size: 27
32 # CHECK-NEXT: offset: 0x310
33 # CHECK-NEXT: align: 4
34 # CHECK-NEXT: reloff: 0x468
35 # CHECK-NEXT: nreloc: 2
36 # CHECK-NEXT: flags: 0x80000400
37 # CHECK-NEXT: reserved1: 0x0
38 # CHECK-NEXT: reserved2: 0x0
39 # CHECK-NEXT: reserved3: 0x0
40 # CHECK-NEXT: content:
41 # CHECK-NEXT: relocations:
42 # CHECK-NEXT: - address: 0x15
43 # CHECK-NEXT: symbolnum: 3
44 # CHECK-NEXT: pcrel: true
45 # CHECK-NEXT: length: 2
46 # CHECK-NEXT: extern: true
48 # CHECK-NEXT: scattered: false
49 # CHECK-NEXT: value: 0
50 # CHECK-NEXT: - address: 0xE
51 # CHECK-NEXT: symbolnum: 6
52 # CHECK-NEXT: pcrel: true
53 # CHECK-NEXT: length: 2
54 # CHECK-NEXT: extern: true
56 # CHECK-NEXT: scattered: false
57 # CHECK-NEXT: value: 0
58 # CHECK-NEXT: - sectname: __StaticInit
59 # CHECK-NEXT: segname: __TEXT
60 # CHECK-NEXT: addr: 0x20
61 # CHECK-NEXT: size: 43
62 # CHECK-NEXT: offset: 0x330
63 # CHECK-NEXT: align: 4
64 # CHECK-NEXT: reloff: 0x478
65 # CHECK-NEXT: nreloc: 4
66 # CHECK-NEXT: flags: 0x80000400
67 # CHECK-NEXT: reserved1: 0x0
68 # CHECK-NEXT: reserved2: 0x0
69 # CHECK-NEXT: reserved3: 0x0
70 # CHECK-NEXT: content:
71 # CHECK-NEXT: relocations:
72 # CHECK-NEXT: - address: 0x25
73 # CHECK-NEXT: symbolnum: 0
74 # CHECK-NEXT: pcrel: true
75 # CHECK-NEXT: length: 2
76 # CHECK-NEXT: extern: true
78 # CHECK-NEXT: scattered: false
79 # CHECK-NEXT: value: 0
80 # CHECK-NEXT: - address: 0x18
81 # CHECK-NEXT: symbolnum: 3
82 # CHECK-NEXT: pcrel: true
83 # CHECK-NEXT: length: 2
84 # CHECK-NEXT: extern: true
86 # CHECK-NEXT: scattered: false
87 # CHECK-NEXT: value: 0
88 # CHECK-NEXT: - address: 0xE
89 # CHECK-NEXT: symbolnum: 4
90 # CHECK-NEXT: pcrel: true
91 # CHECK-NEXT: length: 2
92 # CHECK-NEXT: extern: true
94 # CHECK-NEXT: scattered: false
95 # CHECK-NEXT: value: 0
96 # CHECK-NEXT: - address: 0x7
97 # CHECK-NEXT: symbolnum: 5
98 # CHECK-NEXT: pcrel: true
99 # CHECK-NEXT: length: 2
100 # CHECK-NEXT: extern: true
101 # CHECK-NEXT: type: 1
102 # CHECK-NEXT: scattered: false
103 # CHECK-NEXT: value: 0
104 # CHECK-NEXT: - sectname: __data
105 # CHECK-NEXT: segname: __DATA
106 # CHECK-NEXT: addr: 0x50
107 # CHECK-NEXT: size: 16
108 # CHECK-NEXT: offset: 0x360
109 # CHECK-NEXT: align: 3
110 # CHECK-NEXT: reloff: 0x498
111 # CHECK-NEXT: nreloc: 1
112 # CHECK-NEXT: flags: 0x0
113 # CHECK-NEXT: reserved1: 0x0
114 # CHECK-NEXT: reserved2: 0x0
115 # CHECK-NEXT: reserved3: 0x0
116 # CHECK-NEXT: content: '01000000020000000000000000000000'
117 # CHECK-NEXT: relocations:
118 # CHECK-NEXT: - address: 0x8
119 # CHECK-NEXT: symbolnum: 4
120 # CHECK-NEXT: pcrel: false
121 # CHECK-NEXT: length: 3
122 # CHECK-NEXT: extern: true
123 # CHECK-NEXT: type: 0
124 # CHECK-NEXT: scattered: false
125 # CHECK-NEXT: value: 0
126 # CHECK-NEXT: - sectname: __common
127 # CHECK-NEXT: segname: __DATA
128 # CHECK-NEXT: addr: 0x158
129 # CHECK-NEXT: size: 8
130 # CHECK-NEXT: offset: 0x0
131 # CHECK-NEXT: align: 3
132 # CHECK-NEXT: reloff: 0x0
133 # CHECK-NEXT: nreloc: 0
134 # CHECK-NEXT: flags: 0x1
135 # CHECK-NEXT: reserved1: 0x0
136 # CHECK-NEXT: reserved2: 0x0
137 # CHECK-NEXT: reserved3: 0x0
138 # CHECK-NEXT: - sectname: __mod_init_func
139 # CHECK-NEXT: segname: __DATA
140 # CHECK-NEXT: addr: 0x60
141 # CHECK-NEXT: size: 8
142 # CHECK-NEXT: offset: 0x370
143 # CHECK-NEXT: align: 3
144 # CHECK-NEXT: reloff: 0x4A0
145 # CHECK-NEXT: nreloc: 1
146 # CHECK-NEXT: flags: 0x9
147 # CHECK-NEXT: reserved1: 0x0
148 # CHECK-NEXT: reserved2: 0x0
149 # CHECK-NEXT: reserved3: 0x0
150 # CHECK-NEXT: content:
151 # CHECK-NEXT: relocations:
152 # CHECK-NEXT: - address: 0x0
153 # CHECK-NEXT: symbolnum: 1
154 # CHECK-NEXT: pcrel: false
155 # CHECK-NEXT: length: 3
156 # CHECK-NEXT: extern: true
157 # CHECK-NEXT: type: 0
158 # CHECK-NEXT: scattered: false
159 # CHECK-NEXT: value: 0
160 # CHECK-NEXT: - sectname: __compact_unwind
161 # CHECK-NEXT: segname: __LD
162 # CHECK-NEXT: addr: 0x68
163 # CHECK-NEXT: size: 96
164 # CHECK-NEXT: offset: 0x378
165 # CHECK-NEXT: align: 3
166 # CHECK-NEXT: reloff: 0x4A8
167 # CHECK-NEXT: nreloc: 3
168 # CHECK-NEXT: flags: 0x2000000
169 # CHECK-NEXT: reserved1: 0x0
170 # CHECK-NEXT: reserved2: 0x0
171 # CHECK-NEXT: reserved3: 0x0
172 # CHECK-NEXT: content:
173 # CHECK-NEXT: relocations:
174 # CHECK-NEXT: - address: 0x40
175 # CHECK-NEXT: symbolnum: 2
176 # CHECK-NEXT: pcrel: false
177 # CHECK-NEXT: length: 3
178 # CHECK-NEXT: extern: false
179 # CHECK-NEXT: type: 0
180 # CHECK-NEXT: scattered: false
181 # CHECK-NEXT: value: 0
182 # CHECK-NEXT: - address: 0x20
183 # CHECK-NEXT: symbolnum: 1
184 # CHECK-NEXT: pcrel: false
185 # CHECK-NEXT: length: 3
186 # CHECK-NEXT: extern: false
187 # CHECK-NEXT: type: 0
188 # CHECK-NEXT: scattered: false
189 # CHECK-NEXT: value: 0
190 # CHECK-NEXT: - address: 0x0
191 # CHECK-NEXT: symbolnum: 2
192 # CHECK-NEXT: pcrel: false
193 # CHECK-NEXT: length: 3
194 # CHECK-NEXT: extern: false
195 # CHECK-NEXT: type: 0
196 # CHECK-NEXT: scattered: false
197 # CHECK-NEXT: value: 0
198 # CHECK-NEXT: - sectname: __eh_frame
199 # CHECK-NEXT: segname: __TEXT
200 # CHECK-NEXT: addr: 0xC8
201 # CHECK-NEXT: size: 144
202 # CHECK-NEXT: offset: 0x3D8
203 # CHECK-NEXT: align: 3
204 # CHECK-NEXT: reloff: 0x0
205 # CHECK-NEXT: nreloc: 0
206 # CHECK-NEXT: flags: 0x6800000B
207 # CHECK-NEXT: reserved1: 0x0
208 # CHECK-NEXT: reserved2: 0x0
209 # CHECK-NEXT: reserved3: 0x0
215 cpusubtype: 0x00000003
236 addr: 0x0000000000000000
243 reserved1: 0x00000000
244 reserved2: 0x00000000
245 reserved3: 0x00000000
246 content: 554889E5C745FC00000000488B0500000000480305000000005DC3
248 - address: 0x00000015
256 - address: 0x0000000E
264 - sectname: __StaticInit
266 addr: 0x0000000000000020
273 reserved1: 0x00000000
274 reserved2: 0x00000000
275 reserved3: 0x00000000
276 content: 554889E5488D0500000000488D0D000000004829C148890D000000005DC36690554889E5E8000000005DC3
278 - address: 0x00000025
286 - address: 0x00000018
294 - address: 0x0000000E
302 - address: 0x00000007
312 addr: 0x0000000000000050
319 reserved1: 0x00000000
320 reserved2: 0x00000000
321 reserved3: 0x00000000
322 content: '01000000020000000000000000000000'
324 - address: 0x00000008
334 addr: 0x0000000000000158
341 reserved1: 0x00000000
342 reserved2: 0x00000000
343 reserved3: 0x00000000
344 - sectname: __mod_init_func
346 addr: 0x0000000000000060
353 reserved1: 0x00000000
354 reserved2: 0x00000000
355 reserved3: 0x00000000
356 content: '0000000000000000'
358 - address: 0x00000000
366 - sectname: __compact_unwind
368 addr: 0x0000000000000068
375 reserved1: 0x00000000
376 reserved2: 0x00000000
377 reserved3: 0x00000000
378 content: 20000000000000001E000000000000010000000000000000000000000000000000000000000000001B000000000000010000000000000000000000000000000040000000000000000B0000000000000100000000000000000000000000000000
380 - address: 0x00000040
388 - address: 0x00000020
396 - address: 0x00000000
404 - sectname: __eh_frame
406 addr: 0x00000000000000C8
413 reserved1: 0x00000000
414 reserved2: 0x00000000
415 reserved3: 0x00000000
416 content: 1400000000000000017A520001781001100C070890010000240000001C00000038FFFFFFFFFFFFFF1E0000000000000000410E108602430D06000000000000002400000044000000F0FEFFFFFFFFFFFF1B0000000000000000410E108602430D0600000000000000240000006C00000008FFFFFFFFFFFFFF0B0000000000000000410E108602430D0600000000000000
417 - cmd: LC_VERSION_MIN_MACOSX
490 - ___cxx_global_var_init
491 - __GLOBAL__sub_I_main.cpp