1# RUN: yaml2obj %s | obj2yaml | FileCheck %s
2
3--- !mach-o
4IsLittleEndian:  false
5FileHeader:      
6  magic:           0xFEEDFACE
7  cputype:         0x00000012
8  cpusubtype:      0x00000000
9  filetype:        0x00000001
10  ncmds:           4
11  sizeofcmds:      1264
12  flags:           0x00002000
13LoadCommands:    
14  - cmd:             LC_SEGMENT
15    cmdsize:         1144
16    segname:         ''
17    vmaddr:          0
18    vmsize:          1122
19    fileoff:         1292
20    filesize:        1122
21    maxprot:         7
22    initprot:        7
23    nsects:          16
24    flags:           0
25    Sections:        
26      - sectname:        __text
27        segname:         __TEXT
28        addr:            0x0000000000000000
29        size:            188
30        offset:          0x0000050C
31        align:           4
32        reloff:          0x00000970
33        nreloc:          9
34        flags:           0x80000400
35        reserved1:       0x00000000
36        reserved2:       0x00000000
37        reserved3:       0x00000000
38      - sectname:        __textcoal_nt
39        segname:         __TEXT
40        addr:            0x00000000000000BC
41        size:            0
42        offset:          0x000005C8
43        align:           0
44        reloff:          0x00000000
45        nreloc:          0
46        flags:           0x8000000B
47        reserved1:       0x00000000
48        reserved2:       0x00000000
49        reserved3:       0x00000000
50      - sectname:        __picsymbolstub1
51        segname:         __TEXT
52        addr:            0x00000000000000BC
53        size:            0
54        offset:          0x000005C8
55        align:           0
56        reloff:          0x00000000
57        nreloc:          0
58        flags:           0x80000008
59        reserved1:       0x00000000
60        reserved2:       0x00000020
61        reserved3:       0x00000000
62      - sectname:        __cstring
63        segname:         __TEXT
64        addr:            0x00000000000000BC
65        size:            48
66        offset:          0x000005C8
67        align:           0
68        reloff:          0x00000000
69        nreloc:          0
70        flags:           0x00000002
71        reserved1:       0x00000000
72        reserved2:       0x00000000
73        reserved3:       0x00000000
74      - sectname:        __debug_str
75        segname:         __DWARF
76        addr:            0x00000000000000EC
77        size:            182
78        offset:          0x000005F8
79        align:           0
80        reloff:          0x00000000
81        nreloc:          0
82        flags:           0x02000000
83        reserved1:       0x00000000
84        reserved2:       0x00000000
85        reserved3:       0x00000000
86      - sectname:        __debug_loc
87        segname:         __DWARF
88        addr:            0x00000000000001A2
89        size:            0
90        offset:          0x000006AE
91        align:           0
92        reloff:          0x00000000
93        nreloc:          0
94        flags:           0x02000000
95        reserved1:       0x00000000
96        reserved2:       0x00000000
97        reserved3:       0x00000000
98      - sectname:        __debug_abbrev
99        segname:         __DWARF
100        addr:            0x00000000000001A2
101        size:            104
102        offset:          0x000006AE
103        align:           0
104        reloff:          0x00000000
105        nreloc:          0
106        flags:           0x02000000
107        reserved1:       0x00000000
108        reserved2:       0x00000000
109        reserved3:       0x00000000
110      - sectname:        __debug_info
111        segname:         __DWARF
112        addr:            0x000000000000020A
113        size:            141
114        offset:          0x00000716
115        align:           0
116        reloff:          0x000009B8
117        nreloc:          2
118        flags:           0x02000000
119        reserved1:       0x00000000
120        reserved2:       0x00000000
121        reserved3:       0x00000000
122      - sectname:        __debug_ranges
123        segname:         __DWARF
124        addr:            0x0000000000000297
125        size:            0
126        offset:          0x000007A3
127        align:           0
128        reloff:          0x00000000
129        nreloc:          0
130        flags:           0x02000000
131        reserved1:       0x00000000
132        reserved2:       0x00000000
133        reserved3:       0x00000000
134      - sectname:        __debug_macinfo
135        segname:         __DWARF
136        addr:            0x0000000000000297
137        size:            1
138        offset:          0x000007A3
139        align:           0
140        reloff:          0x00000000
141        nreloc:          0
142        flags:           0x02000000
143        reserved1:       0x00000000
144        reserved2:       0x00000000
145        reserved3:       0x00000000
146      - sectname:        __apple_names
147        segname:         __DWARF
148        addr:            0x0000000000000298
149        size:            60
150        offset:          0x000007A4
151        align:           0
152        reloff:          0x00000000
153        nreloc:          0
154        flags:           0x02000000
155        reserved1:       0x00000000
156        reserved2:       0x00000000
157        reserved3:       0x00000000
158      - sectname:        __apple_objc
159        segname:         __DWARF
160        addr:            0x00000000000002D4
161        size:            36
162        offset:          0x000007E0
163        align:           0
164        reloff:          0x00000000
165        nreloc:          0
166        flags:           0x02000000
167        reserved1:       0x00000000
168        reserved2:       0x00000000
169        reserved3:       0x00000000
170      - sectname:        __apple_namespac
171        segname:         __DWARF
172        addr:            0x00000000000002F8
173        size:            36
174        offset:          0x00000804
175        align:           0
176        reloff:          0x00000000
177        nreloc:          0
178        flags:           0x02000000
179        reserved1:       0x00000000
180        reserved2:       0x00000000
181        reserved3:       0x00000000
182      - sectname:        __apple_types
183        segname:         __DWARF
184        addr:            0x000000000000031C
185        size:            133
186        offset:          0x00000828
187        align:           0
188        reloff:          0x00000000
189        nreloc:          0
190        flags:           0x02000000
191        reserved1:       0x00000000
192        reserved2:       0x00000000
193        reserved3:       0x00000000
194      - sectname:        __debug_frame
195        segname:         __DWARF
196        addr:            0x00000000000003A4
197        size:            48
198        offset:          0x000008B0
199        align:           2
200        reloff:          0x000009C8
201        nreloc:          1
202        flags:           0x02000000
203        reserved1:       0x00000000
204        reserved2:       0x00000000
205        reserved3:       0x00000000
206      - sectname:        __debug_line
207        segname:         __DWARF
208        addr:            0x00000000000003D4
209        size:            142
210        offset:          0x000008E0
211        align:           0
212        reloff:          0x000009D0
213        nreloc:          1
214        flags:           0x02000000
215        reserved1:       0x00000000
216        reserved2:       0x00000000
217        reserved3:       0x00000000
218  - cmd:             LC_VERSION_MIN_MACOSX
219    cmdsize:         16
220    version:         658432
221    sdk:             0
222  - cmd:             LC_SYMTAB
223    cmdsize:         24
224    symoff:          2520
225    nsyms:           2
226    stroff:          2544
227    strsize:         36
228  - cmd:             LC_DYSYMTAB
229    cmdsize:         80
230    ilocalsym:       0
231    nlocalsym:       0
232    iextdefsym:      0
233    nextdefsym:      1
234    iundefsym:       1
235    nundefsym:       1
236    tocoff:          0
237    ntoc:            0
238    modtaboff:       0
239    nmodtab:         0
240    extrefsymoff:    0
241    nextrefsyms:     0
242    indirectsymoff:  0
243    nindirectsyms:   0
244    extreloff:       0
245    nextrel:         0
246    locreloff:       0
247    nlocrel:         0
248LinkEditData:    
249  NameList:        
250    - n_strx:          24
251      n_type:          0x0F
252      n_sect:          1
253      n_desc:          0
254      n_value:         0
255    - n_strx:          1
256      n_type:          0x01
257      n_sect:          0
258      n_desc:          0
259      n_value:         0
260  StringTable:     
261    - ''
262    - _compilerrt_abort_impl
263    - ___absvdi2
264    - ''
265DWARF:           
266  debug_str:       
267    - 'clang version 4.0.0 (trunk 290181) (llvm/trunk 290209)'
268    - ../compiler-rt/lib/builtins/absvdi2.c
269    - /Users/cbieneman/dev/open-source/llvm-build-rel
270    - int
271    - di_int
272    - long long int
273    - __absvdi2
274    - a
275    - N
276    - t
277  debug_abbrev:    
278    - Code:            0x00000001
279      Tag:             DW_TAG_compile_unit
280      Children:        DW_CHILDREN_yes
281      Attributes:      
282        - Attribute:       DW_AT_producer
283          Form:            DW_FORM_strp
284        - Attribute:       DW_AT_language
285          Form:            DW_FORM_data2
286        - Attribute:       DW_AT_name
287          Form:            DW_FORM_strp
288        - Attribute:       DW_AT_stmt_list
289          Form:            DW_FORM_sec_offset
290        - Attribute:       DW_AT_comp_dir
291          Form:            DW_FORM_strp
292        - Attribute:       DW_AT_low_pc
293          Form:            DW_FORM_addr
294        - Attribute:       DW_AT_high_pc
295          Form:            DW_FORM_data4
296    - Code:            0x00000002
297      Tag:             DW_TAG_base_type
298      Children:        DW_CHILDREN_no
299      Attributes:      
300        - Attribute:       DW_AT_name
301          Form:            DW_FORM_strp
302        - Attribute:       DW_AT_encoding
303          Form:            DW_FORM_data1
304        - Attribute:       DW_AT_byte_size
305          Form:            DW_FORM_data1
306    - Code:            0x00000003
307      Tag:             DW_TAG_typedef
308      Children:        DW_CHILDREN_no
309      Attributes:      
310        - Attribute:       DW_AT_type
311          Form:            DW_FORM_ref4
312        - Attribute:       DW_AT_name
313          Form:            DW_FORM_strp
314        - Attribute:       DW_AT_decl_file
315          Form:            DW_FORM_data1
316        - Attribute:       DW_AT_decl_line
317          Form:            DW_FORM_data1
318    - Code:            0x00000004
319      Tag:             DW_TAG_subprogram
320      Children:        DW_CHILDREN_yes
321      Attributes:      
322        - Attribute:       DW_AT_low_pc
323          Form:            DW_FORM_addr
324        - Attribute:       DW_AT_high_pc
325          Form:            DW_FORM_data4
326        - Attribute:       DW_AT_frame_base
327          Form:            DW_FORM_exprloc
328        - Attribute:       DW_AT_name
329          Form:            DW_FORM_strp
330        - Attribute:       DW_AT_decl_file
331          Form:            DW_FORM_data1
332        - Attribute:       DW_AT_decl_line
333          Form:            DW_FORM_data1
334        - Attribute:       DW_AT_prototyped
335          Form:            DW_FORM_flag_present
336        - Attribute:       DW_AT_type
337          Form:            DW_FORM_ref4
338        - Attribute:       DW_AT_external
339          Form:            DW_FORM_flag_present
340    - Code:            0x00000005
341      Tag:             DW_TAG_formal_parameter
342      Children:        DW_CHILDREN_no
343      Attributes:      
344        - Attribute:       DW_AT_location
345          Form:            DW_FORM_exprloc
346        - Attribute:       DW_AT_name
347          Form:            DW_FORM_strp
348        - Attribute:       DW_AT_decl_file
349          Form:            DW_FORM_data1
350        - Attribute:       DW_AT_decl_line
351          Form:            DW_FORM_data1
352        - Attribute:       DW_AT_type
353          Form:            DW_FORM_ref4
354    - Code:            0x00000006
355      Tag:             DW_TAG_variable
356      Children:        DW_CHILDREN_no
357      Attributes:      
358        - Attribute:       DW_AT_location
359          Form:            DW_FORM_exprloc
360        - Attribute:       DW_AT_name
361          Form:            DW_FORM_strp
362        - Attribute:       DW_AT_decl_file
363          Form:            DW_FORM_data1
364        - Attribute:       DW_AT_decl_line
365          Form:            DW_FORM_data1
366        - Attribute:       DW_AT_type
367          Form:            DW_FORM_ref4
368    - Code:            0x00000007
369      Tag:             DW_TAG_const_type
370      Children:        DW_CHILDREN_no
371      Attributes:      
372        - Attribute:       DW_AT_type
373          Form:            DW_FORM_ref4
374...
375
376#CHECK: DWARF:
377#CHECK:   debug_str:
378#CHECK:     - 'clang version 4.0.0 (trunk 290181) (llvm/trunk 290209)'
379#CHECK:     - ../compiler-rt/lib/builtins/absvdi2.c
380#CHECK:     - /Users/cbieneman/dev/open-source/llvm-build-rel
381#CHECK:     - int
382#CHECK:     - di_int
383#CHECK:     - long long int
384#CHECK:     - __absvdi2
385#CHECK:     - a
386#CHECK:     - N
387#CHECK:     - t
388#CHECK:   debug_abbrev:
389#CHECK:     - Code:            0x00000001
390#CHECK:       Tag:             DW_TAG_compile_unit
391#CHECK:       Children:        DW_CHILDREN_yes
392#CHECK:       Attributes:
393#CHECK:         - Attribute:       DW_AT_producer
394#CHECK:           Form:            DW_FORM_strp
395#CHECK:         - Attribute:       DW_AT_language
396#CHECK:           Form:            DW_FORM_data2
397#CHECK:         - Attribute:       DW_AT_name
398#CHECK:           Form:            DW_FORM_strp
399#CHECK:         - Attribute:       DW_AT_stmt_list
400#CHECK:           Form:            DW_FORM_sec_offset
401#CHECK:         - Attribute:       DW_AT_comp_dir
402#CHECK:           Form:            DW_FORM_strp
403#CHECK:         - Attribute:       DW_AT_low_pc
404#CHECK:           Form:            DW_FORM_addr
405#CHECK:         - Attribute:       DW_AT_high_pc
406#CHECK:           Form:            DW_FORM_data4
407#CHECK:     - Code:            0x00000002
408#CHECK:       Tag:             DW_TAG_base_type
409#CHECK:       Children:        DW_CHILDREN_no
410#CHECK:       Attributes:
411#CHECK:         - Attribute:       DW_AT_name
412#CHECK:           Form:            DW_FORM_strp
413#CHECK:         - Attribute:       DW_AT_encoding
414#CHECK:           Form:            DW_FORM_data1
415#CHECK:         - Attribute:       DW_AT_byte_size
416#CHECK:           Form:            DW_FORM_data1
417#CHECK:     - Code:            0x00000003
418#CHECK:       Tag:             DW_TAG_typedef
419#CHECK:       Children:        DW_CHILDREN_no
420#CHECK:       Attributes:
421#CHECK:         - Attribute:       DW_AT_type
422#CHECK:           Form:            DW_FORM_ref4
423#CHECK:         - Attribute:       DW_AT_name
424#CHECK:           Form:            DW_FORM_strp
425#CHECK:         - Attribute:       DW_AT_decl_file
426#CHECK:           Form:            DW_FORM_data1
427#CHECK:         - Attribute:       DW_AT_decl_line
428#CHECK:           Form:            DW_FORM_data1
429#CHECK:     - Code:            0x00000004
430#CHECK:       Tag:             DW_TAG_subprogram
431#CHECK:       Children:        DW_CHILDREN_yes
432#CHECK:       Attributes:
433#CHECK:         - Attribute:       DW_AT_low_pc
434#CHECK:           Form:            DW_FORM_addr
435#CHECK:         - Attribute:       DW_AT_high_pc
436#CHECK:           Form:            DW_FORM_data4
437#CHECK:         - Attribute:       DW_AT_frame_base
438#CHECK:           Form:            DW_FORM_exprloc
439#CHECK:         - Attribute:       DW_AT_name
440#CHECK:           Form:            DW_FORM_strp
441#CHECK:         - Attribute:       DW_AT_decl_file
442#CHECK:           Form:            DW_FORM_data1
443#CHECK:         - Attribute:       DW_AT_decl_line
444#CHECK:           Form:            DW_FORM_data1
445#CHECK:         - Attribute:       DW_AT_prototyped
446#CHECK:           Form:            DW_FORM_flag_present
447#CHECK:         - Attribute:       DW_AT_type
448#CHECK:           Form:            DW_FORM_ref4
449#CHECK:         - Attribute:       DW_AT_external
450#CHECK:           Form:            DW_FORM_flag_present
451#CHECK:     - Code:            0x00000005
452#CHECK:       Tag:             DW_TAG_formal_parameter
453#CHECK:       Children:        DW_CHILDREN_no
454#CHECK:       Attributes:
455#CHECK:         - Attribute:       DW_AT_location
456#CHECK:           Form:            DW_FORM_exprloc
457#CHECK:         - Attribute:       DW_AT_name
458#CHECK:           Form:            DW_FORM_strp
459#CHECK:         - Attribute:       DW_AT_decl_file
460#CHECK:           Form:            DW_FORM_data1
461#CHECK:         - Attribute:       DW_AT_decl_line
462#CHECK:           Form:            DW_FORM_data1
463#CHECK:         - Attribute:       DW_AT_type
464#CHECK:           Form:            DW_FORM_ref4
465#CHECK:     - Code:            0x00000006
466#CHECK:       Tag:             DW_TAG_variable
467#CHECK:       Children:        DW_CHILDREN_no
468#CHECK:       Attributes:
469#CHECK:         - Attribute:       DW_AT_location
470#CHECK:           Form:            DW_FORM_exprloc
471#CHECK:         - Attribute:       DW_AT_name
472#CHECK:           Form:            DW_FORM_strp
473#CHECK:         - Attribute:       DW_AT_decl_file
474#CHECK:           Form:            DW_FORM_data1
475#CHECK:         - Attribute:       DW_AT_decl_line
476#CHECK:           Form:            DW_FORM_data1
477#CHECK:         - Attribute:       DW_AT_type
478#CHECK:           Form:            DW_FORM_ref4
479#CHECK:     - Code:            0x00000007
480#CHECK:       Tag:             DW_TAG_const_type
481#CHECK:       Children:        DW_CHILDREN_no
482#CHECK:       Attributes:
483#CHECK:         - Attribute:       DW_AT_type
484#CHECK:          Form:            DW_FORM_ref4
485
486