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