1# RUN: yaml2obj %s | obj2yaml | FileCheck %s
2
3--- !mach-o
4FileHeader:      
5  magic:           0xFEEDFACF
6  cputype:         0x01000007
7  cpusubtype:      0x00000003
8  filetype:        0x0000000A
9  ncmds:           7
10  sizeofcmds:      1848
11  flags:           0x00000000
12  reserved:        0x00000000
13LoadCommands:    
14  - cmd:             LC_UUID
15    cmdsize:         24
16    uuid:            B4D48511-37F4-3ED4-AFA7-1683DCE69AC4
17  - cmd:             LC_SYMTAB
18    cmdsize:         24
19    symoff:          4096
20    nsyms:           2
21    stroff:          4128
22    strsize:         28
23  - cmd:             LC_SEGMENT_64
24    cmdsize:         72
25    segname:         __PAGEZERO
26    vmaddr:          0
27    vmsize:          4294967296
28    fileoff:         0
29    filesize:        0
30    maxprot:         0
31    initprot:        0
32    nsects:          0
33    flags:           0
34  - cmd:             LC_SEGMENT_64
35    cmdsize:         472
36    segname:         __TEXT
37    vmaddr:          4294967296
38    vmsize:          4096
39    fileoff:         0
40    filesize:        0
41    maxprot:         7
42    initprot:        5
43    nsects:          5
44    flags:           0
45    Sections:        
46      - sectname:        __text
47        segname:         __TEXT
48        addr:            0x0000000100000F50
49        size:            52
50        offset:          0x00000000
51        align:           4
52        reloff:          0x00000000
53        nreloc:          0
54        flags:           0x80000400
55        reserved1:       0x00000000
56        reserved2:       0x00000000
57        reserved3:       0x00000000
58      - sectname:        __stubs
59        segname:         __TEXT
60        addr:            0x0000000100000F84
61        size:            6
62        offset:          0x00000000
63        align:           1
64        reloff:          0x00000000
65        nreloc:          0
66        flags:           0x80000408
67        reserved1:       0x00000000
68        reserved2:       0x00000006
69        reserved3:       0x00000000
70      - sectname:        __stub_helper
71        segname:         __TEXT
72        addr:            0x0000000100000F8C
73        size:            26
74        offset:          0x00000000
75        align:           2
76        reloff:          0x00000000
77        nreloc:          0
78        flags:           0x80000400
79        reserved1:       0x00000000
80        reserved2:       0x00000000
81        reserved3:       0x00000000
82      - sectname:        __cstring
83        segname:         __TEXT
84        addr:            0x0000000100000FA6
85        size:            14
86        offset:          0x00000000
87        align:           0
88        reloff:          0x00000000
89        nreloc:          0
90        flags:           0x00000002
91        reserved1:       0x00000000
92        reserved2:       0x00000000
93        reserved3:       0x00000000
94      - sectname:        __unwind_info
95        segname:         __TEXT
96        addr:            0x0000000100000FB4
97        size:            72
98        offset:          0x00000000
99        align:           2
100        reloff:          0x00000000
101        nreloc:          0
102        flags:           0x00000000
103        reserved1:       0x00000000
104        reserved2:       0x00000000
105        reserved3:       0x00000000
106  - cmd:             LC_SEGMENT_64
107    cmdsize:         232
108    segname:         __DATA
109    vmaddr:          4294971392
110    vmsize:          4096
111    fileoff:         0
112    filesize:        0
113    maxprot:         7
114    initprot:        3
115    nsects:          2
116    flags:           0
117    Sections:        
118      - sectname:        __nl_symbol_ptr
119        segname:         __DATA
120        addr:            0x0000000100001000
121        size:            16
122        offset:          0x00000000
123        align:           3
124        reloff:          0x00000000
125        nreloc:          0
126        flags:           0x00000006
127        reserved1:       0x00000001
128        reserved2:       0x00000000
129        reserved3:       0x00000000
130      - sectname:        __la_symbol_ptr
131        segname:         __DATA
132        addr:            0x0000000100001010
133        size:            8
134        offset:          0x00000000
135        align:           3
136        reloff:          0x00000000
137        nreloc:          0
138        flags:           0x00000007
139        reserved1:       0x00000003
140        reserved2:       0x00000000
141        reserved3:       0x00000000
142  - cmd:             LC_SEGMENT_64
143    cmdsize:         72
144    segname:         __LINKEDIT
145    vmaddr:          4294975488
146    vmsize:          4096
147    fileoff:         4096
148    filesize:        60
149    maxprot:         7
150    initprot:        1
151    nsects:          0
152    flags:           0
153  - cmd:             LC_SEGMENT_64
154    cmdsize:         952
155    segname:         __DWARF
156    vmaddr:          4294979584
157    vmsize:          4096
158    fileoff:         8192
159    filesize:        764
160    maxprot:         7
161    initprot:        3
162    nsects:          11
163    flags:           0
164    Sections:        
165      - sectname:        __debug_line
166        segname:         __DWARF
167        addr:            0x0000000100003000
168        size:            69
169        offset:          0x00002000
170        align:           0
171        reloff:          0x00000000
172        nreloc:          0
173        flags:           0x00000000
174        reserved1:       0x00000000
175        reserved2:       0x00000000
176        reserved3:       0x00000000
177      - sectname:        __debug_pubnames
178        segname:         __DWARF
179        addr:            0x0000000100003045
180        size:            27
181        offset:          0x00002045
182        align:           0
183        reloff:          0x00000000
184        nreloc:          0
185        flags:           0x00000000
186        reserved1:       0x00000000
187        reserved2:       0x00000000
188        reserved3:       0x00000000
189      - sectname:        __debug_pubtypes
190        segname:         __DWARF
191        addr:            0x0000000100003060
192        size:            35
193        offset:          0x00002060
194        align:           0
195        reloff:          0x00000000
196        nreloc:          0
197        flags:           0x00000000
198        reserved1:       0x00000000
199        reserved2:       0x00000000
200        reserved3:       0x00000000
201      - sectname:        __debug_aranges
202        segname:         __DWARF
203        addr:            0x0000000100003083
204        size:            48
205        offset:          0x00002083
206        align:           0
207        reloff:          0x00000000
208        nreloc:          0
209        flags:           0x00000000
210        reserved1:       0x00000000
211        reserved2:       0x00000000
212        reserved3:       0x00000000
213      - sectname:        __debug_info
214        segname:         __DWARF
215        addr:            0x00000001000030B3
216        size:            121
217        offset:          0x000020B3
218        align:           0
219        reloff:          0x00000000
220        nreloc:          0
221        flags:           0x00000000
222        reserved1:       0x00000000
223        reserved2:       0x00000000
224        reserved3:       0x00000000
225      - sectname:        __debug_abbrev
226        segname:         __DWARF
227        addr:            0x000000010000312C
228        size:            76
229        offset:          0x0000212C
230        align:           0
231        reloff:          0x00000000
232        nreloc:          0
233        flags:           0x00000000
234        reserved1:       0x00000000
235        reserved2:       0x00000000
236        reserved3:       0x00000000
237      - sectname:        __debug_str
238        segname:         __DWARF
239        addr:            0x0000000100003178
240        size:            142
241        offset:          0x00002178
242        align:           0
243        reloff:          0x00000000
244        nreloc:          0
245        flags:           0x00000000
246        reserved1:       0x00000000
247        reserved2:       0x00000000
248        reserved3:       0x00000000
249      - sectname:        __apple_names
250        segname:         __DWARF
251        addr:            0x0000000100003206
252        size:            60
253        offset:          0x00002206
254        align:           0
255        reloff:          0x00000000
256        nreloc:          0
257        flags:           0x00000000
258        reserved1:       0x00000000
259        reserved2:       0x00000000
260        reserved3:       0x00000000
261      - sectname:        __apple_namespac
262        segname:         __DWARF
263        addr:            0x0000000100003242
264        size:            36
265        offset:          0x00002242
266        align:           0
267        reloff:          0x00000000
268        nreloc:          0
269        flags:           0x00000000
270        reserved1:       0x00000000
271        reserved2:       0x00000000
272        reserved3:       0x00000000
273      - sectname:        __apple_types
274        segname:         __DWARF
275        addr:            0x0000000100003266
276        size:            114
277        offset:          0x00002266
278        align:           0
279        reloff:          0x00000000
280        nreloc:          0
281        flags:           0x00000000
282        reserved1:       0x00000000
283        reserved2:       0x00000000
284        reserved3:       0x00000000
285      - sectname:        __apple_objc
286        segname:         __DWARF
287        addr:            0x00000001000032D8
288        size:            36
289        offset:          0x000022D8
290        align:           0
291        reloff:          0x00000000
292        nreloc:          0
293        flags:           0x00000000
294        reserved1:       0x00000000
295        reserved2:       0x00000000
296        reserved3:       0x00000000
297LinkEditData:    
298  NameList:        
299    - n_strx:          2
300      n_type:          0x0F
301      n_sect:          1
302      n_desc:          16
303      n_value:         4294967296
304    - n_strx:          22
305      n_type:          0x0F
306      n_sect:          1
307      n_desc:          0
308      n_value:         4294971216
309  StringTable:     
310    - ''
311    - ''
312    - __mh_execute_header
313    - _main
314DWARF:           
315  debug_str:       
316    - ''
317    - 'clang version 4.0.0 (trunk 288923) (llvm/trunk 288991)'
318    - hello_world.c
319    - /Users/cbieneman/dev/open-source/llvm-build-rel
320    - main
321    - argc
322    - argv
323    - int
324    - char
325  debug_abbrev:    
326    - Code:            0x00000001
327      Tag:             DW_TAG_compile_unit
328      Children:        DW_CHILDREN_yes
329      Attributes:      
330        - Attribute:       DW_AT_producer
331          Form:            DW_FORM_strp
332        - Attribute:       DW_AT_language
333          Form:            DW_FORM_data2
334        - Attribute:       DW_AT_name
335          Form:            DW_FORM_strp
336        - Attribute:       DW_AT_stmt_list
337          Form:            DW_FORM_sec_offset
338        - Attribute:       DW_AT_comp_dir
339          Form:            DW_FORM_strp
340        - Attribute:       DW_AT_low_pc
341          Form:            DW_FORM_addr
342        - Attribute:       DW_AT_high_pc
343          Form:            DW_FORM_data4
344    - Code:            0x00000002
345      Tag:             DW_TAG_subprogram
346      Children:        DW_CHILDREN_yes
347      Attributes:      
348        - Attribute:       DW_AT_low_pc
349          Form:            DW_FORM_addr
350        - Attribute:       DW_AT_high_pc
351          Form:            DW_FORM_data4
352        - Attribute:       DW_AT_frame_base
353          Form:            DW_FORM_exprloc
354        - Attribute:       DW_AT_name
355          Form:            DW_FORM_strp
356        - Attribute:       DW_AT_decl_file
357          Form:            DW_FORM_data1
358        - Attribute:       DW_AT_decl_line
359          Form:            DW_FORM_data1
360        - Attribute:       DW_AT_prototyped
361          Form:            DW_FORM_flag_present
362        - Attribute:       DW_AT_type
363          Form:            DW_FORM_ref4
364        - Attribute:       DW_AT_external
365          Form:            DW_FORM_flag_present
366    - Code:            0x00000003
367      Tag:             DW_TAG_formal_parameter
368      Children:        DW_CHILDREN_no
369      Attributes:      
370        - Attribute:       DW_AT_location
371          Form:            DW_FORM_exprloc
372        - Attribute:       DW_AT_name
373          Form:            DW_FORM_strp
374        - Attribute:       DW_AT_decl_file
375          Form:            DW_FORM_data1
376        - Attribute:       DW_AT_decl_line
377          Form:            DW_FORM_data1
378        - Attribute:       DW_AT_type
379          Form:            DW_FORM_ref4
380    - Code:            0x00000004
381      Tag:             DW_TAG_base_type
382      Children:        DW_CHILDREN_no
383      Attributes:      
384        - Attribute:       DW_AT_name
385          Form:            DW_FORM_strp
386        - Attribute:       DW_AT_encoding
387          Form:            DW_FORM_data1
388        - Attribute:       DW_AT_byte_size
389          Form:            DW_FORM_data1
390    - Code:            0x00000005
391      Tag:             DW_TAG_pointer_type
392      Children:        DW_CHILDREN_no
393      Attributes:      
394        - Attribute:       DW_AT_type
395          Form:            DW_FORM_ref4
396  debug_aranges:   
397    - Length:
398        TotalLength:     44
399      Version:         2
400      CuOffset:        0
401      AddrSize:        8
402      SegSize:         0
403      Descriptors:     
404        - Address:         0x0000000100000F50
405          Length:          52
406  debug_pubnames:  
407    Length:          
408      TotalLength:     23
409    Version:         2
410    UnitOffset:      0
411    UnitSize:        121
412    Entries:         
413      - DieOffset:       0x0000002A
414        Name:            main
415  debug_pubtypes:  
416    Length:          
417      TotalLength:     31
418    Version:         2
419    UnitOffset:      0
420    UnitSize:        121
421    Entries:         
422      - DieOffset:       0x00000060
423        Name:            int
424      - DieOffset:       0x00000071
425        Name:            char
426  debug_info:      
427    - Length:
428        TotalLength:     117
429      Version:         4
430      AbbrOffset:      0
431      AddrSize:        8
432      Entries:         
433        - AbbrCode:        0x00000001
434          Values:          
435            - Value:           0x0000000000000001
436            - Value:           0x000000000000000C
437            - Value:           0x0000000000000038
438            - Value:           0x0000000000000000
439            - Value:           0x0000000000000046
440            - Value:           0x0000000100000F50
441            - Value:           0x0000000000000034
442        - AbbrCode:        0x00000002
443          Values:          
444            - Value:           0x0000000100000F50
445            - Value:           0x0000000000000034
446            - Value:           0x0000000000000001
447              BlockData:       
448                - 0x56
449            - Value:           0x0000000000000076
450            - Value:           0x0000000000000001
451            - Value:           0x0000000000000003
452            - Value:           0x0000000000000001
453            - Value:           0x0000000000000060
454            - Value:           0x0000000000000001
455        - AbbrCode:        0x00000003
456          Values:          
457            - Value:           0x0000000000000002
458              BlockData:       
459                - 0x91
460                - 0x78
461            - Value:           0x000000000000007B
462            - Value:           0x0000000000000001
463            - Value:           0x0000000000000003
464            - Value:           0x0000000000000060
465        - AbbrCode:        0x00000003
466          Values:          
467            - Value:           0x0000000000000002
468              BlockData:       
469                - 0x91
470                - 0x70
471            - Value:           0x0000000000000080
472            - Value:           0x0000000000000001
473            - Value:           0x0000000000000003
474            - Value:           0x0000000000000067
475        - AbbrCode:        0x00000000
476          Values:          
477        - AbbrCode:        0x00000004
478          Values:          
479            - Value:           0x0000000000000085
480            - Value:           0x0000000000000005
481            - Value:           0x0000000000000004
482        - AbbrCode:        0x00000005
483          Values:          
484            - Value:           0x000000000000006C
485        - AbbrCode:        0x00000005
486          Values:          
487            - Value:           0x0000000000000071
488        - AbbrCode:        0x00000004
489          Values:          
490            - Value:           0x0000000000000089
491            - Value:           0x0000000000000006
492            - Value:           0x0000000000000001
493        - AbbrCode:        0x00000000
494          Values:          
495  debug_line:      
496    - Length:
497        TotalLength:     65
498      Version:         2
499      PrologueLength:  36
500      MinInstLength:   1
501      DefaultIsStmt:   1
502      LineBase:        251
503      LineRange:       14
504      OpcodeBase:      13
505      StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
506      IncludeDirs:     
507      Files:           
508        - Name:            hello_world.c
509          DirIdx:          0
510          ModTime:         0
511          Length:          0
512      Opcodes:         
513        - Opcode:          DW_LNS_extended_op
514          ExtLen:          9
515          SubOpcode:       DW_LNE_set_address
516          Data:            4294971216
517        - Opcode:          0x14
518          Data:            4294971216
519        - Opcode:          DW_LNS_set_column
520          Data:            3
521        - Opcode:          DW_LNS_set_prologue_end
522          Data:            3
523        - Opcode:          DW_LNS_const_add_pc
524          Data:            3
525        - Opcode:          0xBB
526          Data:            3
527        - Opcode:          0xBB
528          Data:            3
529        - Opcode:          DW_LNS_advance_pc
530          Data:            11
531        - Opcode:          DW_LNS_extended_op
532          ExtLen:          1
533          SubOpcode:       DW_LNE_end_sequence
534          Data:            11
535...
536
537#CHECK:   debug_line:
538#CHECK:     - Length:
539#CHECK:         TotalLength:     65
540#CHECK:       Version:         2
541#CHECK:       PrologueLength:  36
542#CHECK:       MinInstLength:   1
543#CHECK:       DefaultIsStmt:   1
544#CHECK:       LineBase:        251
545#CHECK:       LineRange:       14
546#CHECK:       OpcodeBase:      13
547#CHECK:       StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
548#CHECK:       IncludeDirs:
549#CHECK:       Files:
550#CHECK:         - Name:            hello_world.c
551#CHECK:           DirIdx:          0
552#CHECK:           ModTime:         0
553#CHECK:           Length:          0
554#CHECK:       Opcodes:
555#CHECK:         - Opcode:          DW_LNS_extended_op
556#CHECK:           ExtLen:          9
557#CHECK:           SubOpcode:       DW_LNE_set_address
558#CHECK:           Data:            4294971216
559#CHECK:         - Opcode:          0x14
560#CHECK:           Data:            4294971216
561#CHECK:         - Opcode:          DW_LNS_set_column
562#CHECK:           Data:            3
563#CHECK:         - Opcode:          DW_LNS_set_prologue_end
564#CHECK:           Data:            3
565#CHECK:         - Opcode:          DW_LNS_const_add_pc
566#CHECK:           Data:            3
567#CHECK:         - Opcode:          0xBB
568#CHECK:           Data:            3
569#CHECK:         - Opcode:          0xBB
570#CHECK:           Data:            3
571#CHECK:         - Opcode:          DW_LNS_advance_pc
572#CHECK:           Data:            11
573#CHECK:         - Opcode:          DW_LNS_extended_op
574#CHECK:           ExtLen:          1
575#CHECK:           SubOpcode:       DW_LNE_end_sequence
576#CHECK:           Data:            11
577#CHECK: ...
578