• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-objdump -p %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
2// RUN: llvm-objdump -p %p/Inputs/hello.exe.macho-x86_64 \
3// RUN:     | FileCheck %s -check-prefix=EXE
4// RUN: llvm-objdump -p %p/Inputs/dylibLoadKinds.macho-x86_64 \
5// RUN:     | FileCheck %s -check-prefix=LOAD
6// RUN: llvm-objdump -p %p/Inputs/linkerOption.macho-x86_64 \
7// RUN:     | FileCheck %s -check-prefix=LD_OPT
8// RUN: llvm-objdump -p %p/Inputs/dylibSubFramework.macho-x86_64 \
9// RUN:     | FileCheck %s -check-prefix=SUB_FRAME
10// RUN: llvm-objdump -p %p/Inputs/dylibSubUmbrella.macho-x86_64 \
11// RUN:     | FileCheck %s -check-prefix=SUB_UMB
12// RUN: llvm-objdump -p %p/Inputs/dylibSubLibrary.macho-x86_64 \
13// RUN:     | FileCheck %s -check-prefix=SUB_LIB
14// RUN: llvm-objdump -p %p/Inputs/dylibSubClient.macho-x86_64 \
15// RUN:     | FileCheck %s -check-prefix=SUB_CLI
16// RUN: llvm-objdump -p %p/Inputs/dylibRoutines.macho-x86_64 \
17// RUN:     | FileCheck %s -check-prefix=ROUTINE
18// RUN: llvm-objdump -p %p/Inputs/exeThread.macho-x86_64 \
19// RUN:     | FileCheck %s -check-prefix=THREAD
20// RUN: llvm-objdump -macho -p -arch i386 %p/Inputs/macho-universal.x86_64.i386 \
21// RUN:     | FileCheck %s -check-prefix=FATi386
22// RUN: llvm-objdump -p -non-verbose %p/Inputs/hello.obj.macho-x86_64 \
23// RUN:     | FileCheck %s -check-prefix=NON_VERBOSE
24
25CHECK: Mach header
26CHECK:       magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
27CHECK: MH_MAGIC_64  X86_64        ALL  0x00      OBJECT     3        496 SUBSECTIONS_VIA_SYMBOLS
28CHECK: Load command 0
29CHECK:       cmd LC_SEGMENT_64
30CHECK:   cmdsize 392
31CHECK:   segname
32CHECK:    vmaddr 0x0000000000000000
33CHECK:    vmsize 0x00000000000000a8
34CHECK:   fileoff 528
35CHECK:  filesize 168
36CHECK:   maxprot rwx
37CHECK:  initprot rwx
38CHECK:    nsects 4
39CHECK:     flags (none)
40CHECK: Section
41CHECK:   sectname __text
42CHECK:    segname __TEXT
43CHECK:       addr 0x0000000000000000
44CHECK:       size 0x000000000000003b
45CHECK:     offset 528
46CHECK:      align 2^4 (16)
47CHECK:     reloff 696
48CHECK:     nreloc 2
49CHECK:       type S_REGULAR
50CHECK: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
51CHECK:  reserved1 0
52CHECK:  reserved2 0
53CHECK: Section
54CHECK:   sectname __cstring
55CHECK:    segname __TEXT
56CHECK:       addr 0x000000000000003b
57CHECK:       size 0x000000000000000d
58CHECK:     offset 587
59CHECK:      align 2^0 (1)
60CHECK:     reloff 0
61CHECK:     nreloc 0
62CHECK:       type S_CSTRING_LITERALS
63CHECK: attributes (none)
64CHECK:  reserved1 0
65CHECK:  reserved2 0
66CHECK: Section
67CHECK:   sectname __compact_unwind
68CHECK:    segname __LD
69CHECK:       addr 0x0000000000000048
70CHECK:       size 0x0000000000000020
71CHECK:     offset 600
72CHECK:      align 2^3 (8)
73CHECK:     reloff 712
74CHECK:     nreloc 1
75CHECK:       type S_REGULAR
76CHECK: attributes DEBUG
77CHECK:  reserved1 0
78CHECK:  reserved2 0
79CHECK: Section
80CHECK:   sectname __eh_frame
81CHECK:    segname __TEXT
82CHECK:       addr 0x0000000000000068
83CHECK:       size 0x0000000000000040
84CHECK:     offset 632
85CHECK:      align 2^3 (8)
86CHECK:     reloff 0
87CHECK:     nreloc 0
88CHECK:       type S_COALESCED
89CHECK: attributes NO_TOC STRIP_STATIC_SYMS LIVE_SUPPORT
90CHECK:  reserved1 0
91CHECK:  reserved2 0
92CHECK: Load command 1
93CHECK:      cmd LC_SYMTAB
94CHECK:  cmdsize 24
95CHECK:   symoff 720
96CHECK:    nsyms 5
97CHECK:   stroff 800
98CHECK:  strsize 44
99CHECK: Load command 2
100CHECK:             cmd LC_DYSYMTAB
101CHECK:         cmdsize 80
102CHECK:       ilocalsym 0
103CHECK:       nlocalsym 2
104CHECK:      iextdefsym 2
105CHECK:      nextdefsym 2
106CHECK:       iundefsym 4
107CHECK:       nundefsym 1
108CHECK:          tocoff 0
109CHECK:            ntoc 0
110CHECK:       modtaboff 0
111CHECK:         nmodtab 0
112CHECK:    extrefsymoff 0
113CHECK:     nextrefsyms 0
114CHECK:  indirectsymoff 0
115CHECK:   nindirectsyms 0
116CHECK:       extreloff 0
117CHECK:         nextrel 0
118CHECK:       locreloff 0
119CHECK:         nlocrel 0
120
121EXE: Mach header
122EXE:       magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
123EXE: MH_MAGIC_64  X86_64        ALL LIB64     EXECUTE    16       1296   NOUNDEFS DYLDLINK TWOLEVEL PIE
124EXE: Load command 0
125EXE:       cmd LC_SEGMENT_64
126EXE:   cmdsize 72
127EXE:   segname __PAGEZERO
128EXE:    vmaddr 0x0000000000000000
129EXE:    vmsize 0x0000000100000000
130EXE:   fileoff 0
131EXE:  filesize 0
132EXE:   maxprot ---
133EXE:  initprot ---
134EXE:    nsects 0
135EXE:     flags (none)
136EXE: Load command 1
137EXE:       cmd LC_SEGMENT_64
138EXE:   cmdsize 552
139EXE:   segname __TEXT
140EXE:    vmaddr 0x0000000100000000
141EXE:    vmsize 0x0000000000001000
142EXE:   fileoff 0
143EXE:  filesize 4096
144EXE:   maxprot rwx
145EXE:  initprot r-x
146EXE:    nsects 6
147EXE:     flags (none)
148EXE: Section
149EXE:   sectname __text
150EXE:    segname __TEXT
151EXE:       addr 0x0000000100000f30
152EXE:       size 0x000000000000003b
153EXE:     offset 3888
154EXE:      align 2^4 (16)
155EXE:     reloff 0
156EXE:     nreloc 0
157EXE:       type S_REGULAR
158EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
159EXE:  reserved1 0
160EXE:  reserved2 0
161EXE: Section
162EXE:   sectname __stubs
163EXE:    segname __TEXT
164EXE:       addr 0x0000000100000f6c
165EXE:       size 0x0000000000000006
166EXE:     offset 3948
167EXE:      align 2^1 (2)
168EXE:     reloff 0
169EXE:     nreloc 0
170EXE:       type S_SYMBOL_STUBS
171EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
172EXE:  reserved1 0 (index into indirect symbol table)
173EXE:  reserved2 6 (size of stubs)
174EXE: Section
175EXE:   sectname __stub_helper
176EXE:    segname __TEXT
177EXE:       addr 0x0000000100000f74
178EXE:       size 0x000000000000001a
179EXE:     offset 3956
180EXE:      align 2^2 (4)
181EXE:     reloff 0
182EXE:     nreloc 0
183EXE:       type S_REGULAR
184EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
185EXE:  reserved1 0
186EXE:  reserved2 0
187EXE: Section
188EXE:   sectname __cstring
189EXE:    segname __TEXT
190EXE:       addr 0x0000000100000f8e
191EXE:       size 0x000000000000000d
192EXE:     offset 3982
193EXE:      align 2^0 (1)
194EXE:     reloff 0
195EXE:     nreloc 0
196EXE:       type S_CSTRING_LITERALS
197EXE: attributes (none)
198EXE:  reserved1 0
199EXE:  reserved2 0
200EXE: Section
201EXE:   sectname __unwind_info
202EXE:    segname __TEXT
203EXE:       addr 0x0000000100000f9b
204EXE:       size 0x0000000000000048
205EXE:     offset 3995
206EXE:      align 2^0 (1)
207EXE:     reloff 0
208EXE:     nreloc 0
209EXE:       type S_REGULAR
210EXE: attributes (none)
211EXE:  reserved1 0
212EXE:  reserved2 0
213EXE: Section
214EXE:   sectname __eh_frame
215EXE:    segname __TEXT
216EXE:       addr 0x0000000100000fe8
217EXE:       size 0x0000000000000018
218EXE:     offset 4072
219EXE:      align 2^3 (8)
220EXE:     reloff 0
221EXE:     nreloc 0
222EXE:       type S_REGULAR
223EXE: attributes (none)
224EXE:  reserved1 0
225EXE:  reserved2 0
226EXE: Load command 2
227EXE:       cmd LC_SEGMENT_64
228EXE:   cmdsize 232
229EXE:   segname __DATA
230EXE:    vmaddr 0x0000000100001000
231EXE:    vmsize 0x0000000000001000
232EXE:   fileoff 4096
233EXE:  filesize 4096
234EXE:   maxprot rwx
235EXE:  initprot rw-
236EXE:    nsects 2
237EXE:     flags (none)
238EXE: Section
239EXE:   sectname __nl_symbol_ptr
240EXE:    segname __DATA
241EXE:       addr 0x0000000100001000
242EXE:       size 0x0000000000000010
243EXE:     offset 4096
244EXE:      align 2^3 (8)
245EXE:     reloff 0
246EXE:     nreloc 0
247EXE:       type S_NON_LAZY_SYMBOL_POINTERS
248EXE: attributes (none)
249EXE:  reserved1 1 (index into indirect symbol table)
250EXE:  reserved2 0
251EXE: Section
252EXE:   sectname __la_symbol_ptr
253EXE:    segname __DATA
254EXE:       addr 0x0000000100001010
255EXE:       size 0x0000000000000008
256EXE:     offset 4112
257EXE:      align 2^3 (8)
258EXE:     reloff 0
259EXE:     nreloc 0
260EXE:       type S_LAZY_SYMBOL_POINTERS
261EXE: attributes (none)
262EXE:  reserved1 3 (index into indirect symbol table)
263EXE:  reserved2 0
264EXE: Load command 3
265EXE:       cmd LC_SEGMENT_64
266EXE:   cmdsize 72
267EXE:   segname __LINKEDIT
268EXE:    vmaddr 0x0000000100002000
269EXE:    vmsize 0x0000000000001000
270EXE:   fileoff 8192
271EXE:  filesize 304
272EXE:   maxprot rwx
273EXE:  initprot r--
274EXE:    nsects 0
275EXE:     flags (none)
276EXE: Load command 4
277EXE:             cmd LC_DYLD_INFO_ONLY
278EXE:         cmdsize 48
279EXE:      rebase_off 8192
280EXE:     rebase_size 8
281EXE:        bind_off 8200
282EXE:       bind_size 24
283EXE:   weak_bind_off 0
284EXE:  weak_bind_size 0
285EXE:   lazy_bind_off 8224
286EXE:  lazy_bind_size 16
287EXE:      export_off 8240
288EXE:     export_size 48
289EXE: Load command 5
290EXE:      cmd LC_SYMTAB
291EXE:  cmdsize 24
292EXE:   symoff 8360
293EXE:    nsyms 4
294EXE:   stroff 8440
295EXE:  strsize 56
296EXE: Load command 6
297EXE:             cmd LC_DYSYMTAB
298EXE:         cmdsize 80
299EXE:       ilocalsym 0
300EXE:       nlocalsym 0
301EXE:      iextdefsym 0
302EXE:      nextdefsym 2
303EXE:       iundefsym 2
304EXE:       nundefsym 2
305EXE:          tocoff 0
306EXE:            ntoc 0
307EXE:       modtaboff 0
308EXE:         nmodtab 0
309EXE:    extrefsymoff 0
310EXE:     nextrefsyms 0
311EXE:  indirectsymoff 8424
312EXE:   nindirectsyms 4
313EXE:       extreloff 0
314EXE:         nextrel 0
315EXE:       locreloff 0
316EXE:         nlocrel 0
317EXE: Load command 7
318EXE:           cmd LC_LOAD_DYLINKER
319EXE:       cmdsize 32
320EXE:          name /usr/lib/dyld (offset 12)
321EXE: Load command 8
322EXE:      cmd LC_UUID
323EXE:  cmdsize 24
324EXE:     uuid 65C2DD41-79B0-3B34-871B-8CB3446AB762
325EXE: Load command 9
326EXE:       cmd LC_VERSION_MIN_MACOSX
327EXE:   cmdsize 16
328EXE:   version 10.9
329EXE:       sdk 10.9
330EXE: Load command 10
331EXE:       cmd LC_SOURCE_VERSION
332EXE:   cmdsize 16
333EXE:   version 0.0
334EXE: Load command 11
335EXE:        cmd LC_MAIN
336EXE:    cmdsize 24
337EXE:   entryoff 3888
338EXE:  stacksize 0
339EXE: Load command 12
340EXE:           cmd LC_LOAD_DYLIB
341EXE:       cmdsize 56
342EXE:          name /usr/lib/libSystem.B.dylib (offset 24)
343EXE:       current version 1197.1.1
344EXE: compatibility version 1.0.0
345EXE: Load command 13
346EXE:       cmd LC_FUNCTION_STARTS
347EXE:   cmdsize 16
348EXE:   dataoff 8288
349EXE:  datasize 8
350EXE: Load command 14
351EXE:       cmd LC_DATA_IN_CODE
352EXE:   cmdsize 16
353EXE:   dataoff 8296
354EXE:  datasize 0
355EXE: Load command 15
356EXE:       cmd LC_DYLIB_CODE_SIGN_DRS
357EXE:   cmdsize 16
358EXE:   dataoff 8296
359EXE:  datasize 64
360
361
362LOAD: Load command 10
363LOAD:           cmd LC_LOAD_DYLIB
364LOAD:       cmdsize 48
365LOAD:          name /usr/lib/foo1.dylib (offset 24)
366LOAD:       current version 0.0.0
367LOAD: compatibility version 0.0.0
368LOAD: Load command 11
369LOAD:           cmd LC_LOAD_WEAK_DYLIB
370LOAD:       cmdsize 48
371LOAD:          name /usr/lib/foo2.dylib (offset 24)
372LOAD:       current version 0.0.0
373LOAD: compatibility version 0.0.0
374LOAD: Load command 12
375LOAD:           cmd LC_REEXPORT_DYLIB
376LOAD:       cmdsize 48
377LOAD:          name /usr/lib/foo3.dylib (offset 24)
378LOAD:       current version 0.0.0
379LOAD: compatibility version 0.0.0
380LOAD: Load command 13
381LOAD:           cmd LC_LAZY_LOAD_DYLIB
382LOAD:       cmdsize 48
383LOAD:          name /usr/lib/foo4.dylib (offset 24)
384LOAD:       current version 0.0.0
385LOAD: compatibility version 0.0.0
386
387LD_OPT: Load command 4
388LD_OPT:      cmd LC_LINKER_OPTION
389LD_OPT:  cmdsize 24
390LD_OPT:    count 1
391LD_OPT:   string #1 -lc++
392LD_OPT: Load command 5
393LD_OPT:      cmd LC_LINKER_OPTION
394LD_OPT:  cmdsize 40
395LD_OPT:    count 2
396LD_OPT:   string #1 -framework
397LD_OPT:   string #2 Foundation
398
399SUB_FRAME: Load command 10
400SUB_FRAME:           cmd LC_SUB_FRAMEWORK
401SUB_FRAME:       cmdsize 16
402SUB_FRAME:      umbrella Bar (offset 12)
403
404SUB_UMB: Load command 5
405SUB_UMB:           cmd LC_SUB_UMBRELLA
406SUB_UMB:       cmdsize 16
407SUB_UMB:  sub_umbrella Foo (offset 12)
408
409SUB_LIB: Load command 5
410SUB_LIB:           cmd LC_SUB_LIBRARY
411SUB_LIB:       cmdsize 20
412SUB_LIB:   sub_library libfoo (offset 12)
413
414SUB_CLI: Load command 10
415SUB_CLI:           cmd LC_SUB_CLIENT
416SUB_CLI:       cmdsize 16
417SUB_CLI:        client bar (offset 12)
418
419ROUTINE: Load command 6
420ROUTINE:           cmd LC_ROUTINES_64
421ROUTINE:       cmdsize 72
422ROUTINE:  init_address 0x0000000000000f80
423ROUTINE:   init_module 0
424ROUTINE:     reserved1 0
425ROUTINE:     reserved2 0
426ROUTINE:     reserved3 0
427ROUTINE:     reserved4 0
428ROUTINE:     reserved5 0
429ROUTINE:     reserved6 0
430
431THREAD: Load command 10
432THREAD:         cmd LC_UNIXTHREAD
433THREAD:     cmdsize 184
434THREAD:      flavor x86_THREAD_STATE64
435THREAD:       count x86_THREAD_STATE64_COUNT
436THREAD:    rax  0x0000000000000000 rbx 0x0000000000000000 rcx  0x0000000000000000
437THREAD:    rdx  0x0000000000000000 rdi 0x0000000000000000 rsi  0x0000000000000000
438THREAD:    rbp  0x0000000000000000 rsp 0x0000000000000000 r8   0x0000000000000000
439THREAD:     r9  0x0000000000000000 r10 0x0000000000000000 r11  0x0000000000000000
440THREAD:    r12  0x0000000000000000 r13 0x0000000000000000 r14  0x0000000000000000
441THREAD:    r15  0x0000000000000000 rip 0x0000000100000d00
442THREAD: rflags  0x0000000000000000 cs  0x0000000000000000 fs   0x0000000000000000
443THREAD:     gs  0x0000000000000000
444
445FATi386: Mach header
446FATi386:       magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
447FATi386:    MH_MAGIC    I386        ALL  0x00     EXECUTE    16        716   NOUNDEFS DYLDLINK TWOLEVEL PIE MH_NO_HEAP_EXECUTION
448
449NON_VERBOSE: Mach header
450NON_VERBOSE:       magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
451NON_VERBOSE:  0xfeedfacf 16777223          3  0x00           1     3        496 0x00002000
452NON_VERBOSE: Load command 0
453NON_VERBOSE:       cmd LC_SEGMENT_64
454NON_VERBOSE:   cmdsize 392
455NON_VERBOSE:   segname
456NON_VERBOSE:    vmaddr 0x0000000000000000
457NON_VERBOSE:    vmsize 0x00000000000000a8
458NON_VERBOSE:   fileoff 528
459NON_VERBOSE:  filesize 168
460NON_VERBOSE:   maxprot 0x00000007
461NON_VERBOSE:  initprot 0x00000007
462NON_VERBOSE:    nsects 4
463NON_VERBOSE:     flags 0x0
464NON_VERBOSE: Section
465NON_VERBOSE:   sectname __text
466NON_VERBOSE:    segname __TEXT
467NON_VERBOSE:       addr 0x0000000000000000
468NON_VERBOSE:       size 0x000000000000003b
469NON_VERBOSE:     offset 528
470NON_VERBOSE:      align 2^4 (16)
471NON_VERBOSE:     reloff 696
472NON_VERBOSE:     nreloc 2
473NON_VERBOSE:      flags 0x80000400
474NON_VERBOSE:  reserved1 0
475NON_VERBOSE:  reserved2 0
476NON_VERBOSE: Section
477NON_VERBOSE:   sectname __cstring
478NON_VERBOSE:    segname __TEXT
479NON_VERBOSE:       addr 0x000000000000003b
480NON_VERBOSE:       size 0x000000000000000d
481NON_VERBOSE:     offset 587
482NON_VERBOSE:      align 2^0 (1)
483NON_VERBOSE:     reloff 0
484NON_VERBOSE:     nreloc 0
485NON_VERBOSE:      flags 0x00000002
486NON_VERBOSE:  reserved1 0
487NON_VERBOSE:  reserved2 0
488NON_VERBOSE: Section
489NON_VERBOSE:   sectname __compact_unwind
490NON_VERBOSE:    segname __LD
491NON_VERBOSE:       addr 0x0000000000000048
492NON_VERBOSE:       size 0x0000000000000020
493NON_VERBOSE:     offset 600
494NON_VERBOSE:      align 2^3 (8)
495NON_VERBOSE:     reloff 712
496NON_VERBOSE:     nreloc 1
497NON_VERBOSE:      flags 0x02000000
498NON_VERBOSE:  reserved1 0
499NON_VERBOSE:  reserved2 0
500NON_VERBOSE: Section
501NON_VERBOSE:   sectname __eh_frame
502NON_VERBOSE:    segname __TEXT
503NON_VERBOSE:       addr 0x0000000000000068
504NON_VERBOSE:       size 0x0000000000000040
505NON_VERBOSE:     offset 632
506NON_VERBOSE:      align 2^3 (8)
507NON_VERBOSE:     reloff 0
508NON_VERBOSE:     nreloc 0
509NON_VERBOSE:      flags 0x6800000b
510NON_VERBOSE:  reserved1 0
511NON_VERBOSE:  reserved2 0
512NON_VERBOSE: Load command 1
513NON_VERBOSE:      cmd LC_SYMTAB
514NON_VERBOSE:  cmdsize 24
515NON_VERBOSE:   symoff 720
516NON_VERBOSE:    nsyms 5
517NON_VERBOSE:   stroff 800
518NON_VERBOSE:  strsize 44
519NON_VERBOSE: Load command 2
520NON_VERBOSE:             cmd LC_DYSYMTAB
521NON_VERBOSE:         cmdsize 80
522NON_VERBOSE:       ilocalsym 0
523NON_VERBOSE:       nlocalsym 2
524NON_VERBOSE:      iextdefsym 2
525NON_VERBOSE:      nextdefsym 2
526NON_VERBOSE:       iundefsym 4
527NON_VERBOSE:       nundefsym 1
528NON_VERBOSE:          tocoff 0
529NON_VERBOSE:            ntoc 0
530NON_VERBOSE:       modtaboff 0
531NON_VERBOSE:         nmodtab 0
532NON_VERBOSE:    extrefsymoff 0
533NON_VERBOSE:     nextrefsyms 0
534NON_VERBOSE:  indirectsymoff 0
535NON_VERBOSE:   nindirectsyms 0
536NON_VERBOSE:       extreloff 0
537NON_VERBOSE:         nextrel 0
538NON_VERBOSE:       locreloff 0
539NON_VERBOSE:         nlocrel 0
540