1// RUN: llvm-objdump -p %p/Inputs/hello.obj.macho-aarch64 | FileCheck %s
2// RUN: llvm-objdump -p %p/Inputs/hello.exe.macho-aarch64 \
3// RUN:     | FileCheck %s -check-prefix=EXE
4
5CHECK: Mach header
6CHECK:       magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
7CHECK: MH_MAGIC_64   ARM64        ALL  0x00      OBJECT     4        352 SUBSECTIONS_VIA_SYMBOLS
8CHECK: Load command 0
9CHECK:       cmd LC_SEGMENT_64
10CHECK:   cmdsize 232
11CHECK:   segname
12CHECK:    vmaddr 0x0000000000000000
13CHECK:    vmsize 0x000000000000004d
14CHECK:   fileoff 384
15CHECK:  filesize 77
16CHECK:   maxprot rwx
17CHECK:  initprot rwx
18CHECK:    nsects 2
19CHECK:     flags (none)
20CHECK: Section
21CHECK:   sectname __text
22CHECK:    segname __TEXT
23CHECK:       addr 0x0000000000000000
24CHECK:       size 0x0000000000000040
25CHECK:     offset 384
26CHECK:      align 2^2 (4)
27CHECK:     reloff 464
28CHECK:     nreloc 3
29CHECK:       type S_REGULAR
30CHECK: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
31CHECK:  reserved1 0
32CHECK:  reserved2 0
33CHECK: Section
34CHECK:   sectname __cstring
35CHECK:    segname __TEXT
36CHECK:       addr 0x0000000000000040
37CHECK:       size 0x000000000000000d
38CHECK:     offset 448
39CHECK:      align 2^0 (1)
40CHECK:     reloff 0
41CHECK:     nreloc 0
42CHECK:       type S_CSTRING_LITERALS
43CHECK: attributes (none)
44CHECK:  reserved1 0
45CHECK:  reserved2 0
46CHECK: Load command 1
47CHECK:       cmd LC_VERSION_MIN_IPHONEOS
48CHECK:   cmdsize 16
49CHECK:   version 9.0
50CHECK:       sdk n/a
51CHECK: Load command 2
52CHECK:      cmd LC_SYMTAB
53CHECK:  cmdsize 24
54CHECK:   symoff 488
55CHECK:    nsyms 5
56CHECK:   stroff 568
57CHECK:  strsize 36
58CHECK: Load command 3
59CHECK:             cmd LC_DYSYMTAB
60CHECK:         cmdsize 80
61CHECK:       ilocalsym 0
62CHECK:       nlocalsym 3
63CHECK:      iextdefsym 3
64CHECK:      nextdefsym 1
65CHECK:       iundefsym 4
66CHECK:       nundefsym 1
67CHECK:          tocoff 0
68CHECK:            ntoc 0
69CHECK:       modtaboff 0
70CHECK:         nmodtab 0
71CHECK:    extrefsymoff 0
72CHECK:     nextrefsyms 0
73CHECK:  indirectsymoff 0
74CHECK:   nindirectsyms 0
75CHECK:       extreloff 0
76CHECK:         nextrel 0
77CHECK:       locreloff 0
78CHECK:         nlocrel 0
79
80EXE: Mach header
81EXE:       magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
82EXE: MH_MAGIC_64   ARM64        ALL  0x00     EXECUTE    17       1240   NOUNDEFS DYLDLINK TWOLEVEL PIE
83EXE: Load command 0
84EXE:       cmd LC_SEGMENT_64
85EXE:   cmdsize 72
86EXE:   segname __PAGEZERO
87EXE:    vmaddr 0x0000000000000000
88EXE:    vmsize 0x0000000100000000
89EXE:   fileoff 0
90EXE:  filesize 0
91EXE:   maxprot ---
92EXE:  initprot ---
93EXE:    nsects 0
94EXE:     flags (none)
95EXE: Load command 1
96EXE:       cmd LC_SEGMENT_64
97EXE:   cmdsize 472
98EXE:   segname __TEXT
99EXE:    vmaddr 0x0000000100000000
100EXE:    vmsize 0x0000000000008000
101EXE:   fileoff 0
102EXE:  filesize 32768
103EXE:   maxprot r-x
104EXE:  initprot r-x
105EXE:    nsects 5
106EXE:     flags (none)
107EXE: Section
108EXE:   sectname __text
109EXE:    segname __TEXT
110EXE:       addr 0x0000000100007f38
111EXE:       size 0x0000000000000040
112EXE:     offset 32568
113EXE:      align 2^2 (4)
114EXE:     reloff 0
115EXE:     nreloc 0
116EXE:       type S_REGULAR
117EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
118EXE:  reserved1 0
119EXE:  reserved2 0
120EXE: Section
121EXE:   sectname __stubs
122EXE:    segname __TEXT
123EXE:       addr 0x0000000100007f78
124EXE:       size 0x000000000000000c
125EXE:     offset 32632
126EXE:      align 2^1 (2)
127EXE:     reloff 0
128EXE:     nreloc 0
129EXE:       type S_SYMBOL_STUBS
130EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
131EXE:  reserved1 0 (index into indirect symbol table)
132EXE:  reserved2 12 (size of stubs)
133EXE: Section
134EXE:   sectname __stub_helper
135EXE:    segname __TEXT
136EXE:       addr 0x0000000100007f84
137EXE:       size 0x0000000000000024
138EXE:     offset 32644
139EXE:      align 2^2 (4)
140EXE:     reloff 0
141EXE:     nreloc 0
142EXE:       type S_REGULAR
143EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
144EXE:  reserved1 0
145EXE:  reserved2 0
146EXE: Section
147EXE:   sectname __cstring
148EXE:    segname __TEXT
149EXE:       addr 0x0000000100007fa8
150EXE:       size 0x000000000000000d
151EXE:     offset 32680
152EXE:      align 2^0 (1)
153EXE:     reloff 0
154EXE:     nreloc 0
155EXE:       type S_CSTRING_LITERALS
156EXE: attributes (none)
157EXE:  reserved1 0
158EXE:  reserved2 0
159EXE: Section
160EXE:   sectname __unwind_info
161EXE:    segname __TEXT
162EXE:       addr 0x0000000100007fb8
163EXE:       size 0x0000000000000048
164EXE:     offset 32696
165EXE:      align 2^2 (4)
166EXE:     reloff 0
167EXE:     nreloc 0
168EXE:       type S_REGULAR
169EXE: attributes (none)
170EXE:  reserved1 0
171EXE:  reserved2 0
172EXE: Load command 2
173EXE:       cmd LC_SEGMENT_64
174EXE:   cmdsize 232
175EXE:   segname __DATA
176EXE:    vmaddr 0x0000000100008000
177EXE:    vmsize 0x0000000000004000
178EXE:   fileoff 32768
179EXE:  filesize 16384
180EXE:   maxprot rw-
181EXE:  initprot rw-
182EXE:    nsects 2
183EXE:     flags (none)
184EXE: Section
185EXE:   sectname __got
186EXE:    segname __DATA
187EXE:       addr 0x0000000100008000
188EXE:       size 0x0000000000000010
189EXE:     offset 32768
190EXE:      align 2^3 (8)
191EXE:     reloff 0
192EXE:     nreloc 0
193EXE:       type S_NON_LAZY_SYMBOL_POINTERS
194EXE: attributes (none)
195EXE:  reserved1 1 (index into indirect symbol table)
196EXE:  reserved2 0
197EXE: Section
198EXE:   sectname __la_symbol_ptr
199EXE:    segname __DATA
200EXE:       addr 0x0000000100008010
201EXE:       size 0x0000000000000008
202EXE:     offset 32784
203EXE:      align 2^3 (8)
204EXE:     reloff 0
205EXE:     nreloc 0
206EXE:       type S_LAZY_SYMBOL_POINTERS
207EXE: attributes (none)
208EXE:  reserved1 3 (index into indirect symbol table)
209EXE:  reserved2 0
210EXE: Load command 3
211EXE:       cmd LC_SEGMENT_64
212EXE:   cmdsize 72
213EXE:   segname __LINKEDIT
214EXE:    vmaddr 0x000000010000c000
215EXE:    vmsize 0x0000000000004000
216EXE:   fileoff 49152
217EXE:  filesize 264
218EXE:   maxprot r--
219EXE:  initprot r--
220EXE:    nsects 0
221EXE:     flags (none)
222EXE: Load command 4
223EXE:             cmd LC_DYLD_INFO_ONLY
224EXE:         cmdsize 48
225EXE:      rebase_off 49152
226EXE:     rebase_size 8
227EXE:        bind_off 49160
228EXE:       bind_size 24
229EXE:   weak_bind_off 0
230EXE:  weak_bind_size 0
231EXE:   lazy_bind_off 49184
232EXE:  lazy_bind_size 16
233EXE:      export_off 49200
234EXE:     export_size 48
235EXE: Load command 5
236EXE:      cmd LC_SYMTAB
237EXE:  cmdsize 24
238EXE:   symoff 49280
239EXE:    nsyms 4
240EXE:   stroff 49360
241EXE:  strsize 56
242EXE: Load command 6
243EXE:             cmd LC_DYSYMTAB
244EXE:         cmdsize 80
245EXE:       ilocalsym 0
246EXE:       nlocalsym 0
247EXE:      iextdefsym 0
248EXE:      nextdefsym 2
249EXE:       iundefsym 2
250EXE:       nundefsym 2
251EXE:          tocoff 0
252EXE:            ntoc 0
253EXE:       modtaboff 0
254EXE:         nmodtab 0
255EXE:    extrefsymoff 0
256EXE:     nextrefsyms 0
257EXE:  indirectsymoff 49344
258EXE:   nindirectsyms 4
259EXE:       extreloff 0
260EXE:         nextrel 0
261EXE:       locreloff 0
262EXE:         nlocrel 0
263EXE: Load command 7
264EXE:           cmd LC_LOAD_DYLINKER
265EXE:       cmdsize 32
266EXE:          name /usr/lib/dyld (offset 12)
267EXE: Load command 8
268EXE:      cmd LC_UUID
269EXE:  cmdsize 24
270EXE:     uuid D687F888-CD3F-3276-8C94-BA3CCA21D820
271EXE: Load command 9
272EXE:       cmd LC_VERSION_MIN_IPHONEOS
273EXE:   cmdsize 16
274EXE:   version 9.0
275EXE:       sdk 9.0
276EXE: Load command 10
277EXE:       cmd LC_SOURCE_VERSION
278EXE:   cmdsize 16
279EXE:   version 0.0
280EXE: Load command 11
281EXE:        cmd LC_MAIN
282EXE:    cmdsize 24
283EXE:   entryoff 32568
284EXE:  stacksize 0
285EXE: Load command 12
286EXE:           cmd LC_ENCRYPTION_INFO_64
287EXE:       cmdsize 24
288EXE:      cryptoff 16384
289EXE:     cryptsize 16384
290EXE:       cryptid 0
291EXE:           pad 0
292EXE: Load command 13
293EXE:           cmd LC_LOAD_DYLIB
294EXE:       cmdsize 56
295EXE:          name /usr/lib/libSystem.B.dylib (offset 24)
296EXE:       current version 1215.0.0
297EXE: compatibility version 1.0.0
298EXE: Load command 14
299EXE:       cmd LC_FUNCTION_STARTS
300EXE:   cmdsize 16
301EXE:   dataoff 49248
302EXE:  datasize 8
303EXE: Load command 15
304EXE:       cmd LC_DATA_IN_CODE
305EXE:   cmdsize 16
306EXE:   dataoff 49256
307EXE:  datasize 0
308EXE: Load command 16
309EXE:       cmd LC_DYLIB_CODE_SIGN_DRS
310EXE:   cmdsize 16
311EXE:   dataoff 49256
312EXE:  datasize 24
313