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    - Table:
279        - Code:            0x00000001
280          Tag:             DW_TAG_compile_unit
281          Children:        DW_CHILDREN_yes
282          Attributes:
283            - Attribute:       DW_AT_producer
284              Form:            DW_FORM_strp
285            - Attribute:       DW_AT_language
286              Form:            DW_FORM_data2
287            - Attribute:       DW_AT_name
288              Form:            DW_FORM_strp
289            - Attribute:       DW_AT_stmt_list
290              Form:            DW_FORM_sec_offset
291            - Attribute:       DW_AT_comp_dir
292              Form:            DW_FORM_strp
293            - Attribute:       DW_AT_low_pc
294              Form:            DW_FORM_addr
295            - Attribute:       DW_AT_high_pc
296              Form:            DW_FORM_data4
297        - Code:            0x00000002
298          Tag:             DW_TAG_base_type
299          Children:        DW_CHILDREN_no
300          Attributes:
301            - Attribute:       DW_AT_name
302              Form:            DW_FORM_strp
303            - Attribute:       DW_AT_encoding
304              Form:            DW_FORM_data1
305            - Attribute:       DW_AT_byte_size
306              Form:            DW_FORM_data1
307        - Code:            0x00000003
308          Tag:             DW_TAG_typedef
309          Children:        DW_CHILDREN_no
310          Attributes:
311            - Attribute:       DW_AT_type
312              Form:            DW_FORM_ref4
313            - Attribute:       DW_AT_name
314              Form:            DW_FORM_strp
315            - Attribute:       DW_AT_decl_file
316              Form:            DW_FORM_data1
317            - Attribute:       DW_AT_decl_line
318              Form:            DW_FORM_data1
319        - Code:            0x00000004
320          Tag:             DW_TAG_subprogram
321          Children:        DW_CHILDREN_yes
322          Attributes:
323            - Attribute:       DW_AT_low_pc
324              Form:            DW_FORM_addr
325            - Attribute:       DW_AT_high_pc
326              Form:            DW_FORM_data4
327            - Attribute:       DW_AT_frame_base
328              Form:            DW_FORM_exprloc
329            - Attribute:       DW_AT_name
330              Form:            DW_FORM_strp
331            - Attribute:       DW_AT_decl_file
332              Form:            DW_FORM_data1
333            - Attribute:       DW_AT_decl_line
334              Form:            DW_FORM_data1
335            - Attribute:       DW_AT_prototyped
336              Form:            DW_FORM_flag_present
337            - Attribute:       DW_AT_type
338              Form:            DW_FORM_ref4
339            - Attribute:       DW_AT_external
340              Form:            DW_FORM_flag_present
341        - Code:            0x00000005
342          Tag:             DW_TAG_formal_parameter
343          Children:        DW_CHILDREN_no
344          Attributes:
345            - Attribute:       DW_AT_location
346              Form:            DW_FORM_exprloc
347            - Attribute:       DW_AT_name
348              Form:            DW_FORM_strp
349            - Attribute:       DW_AT_decl_file
350              Form:            DW_FORM_data1
351            - Attribute:       DW_AT_decl_line
352              Form:            DW_FORM_data1
353            - Attribute:       DW_AT_type
354              Form:            DW_FORM_ref4
355        - Code:            0x00000006
356          Tag:             DW_TAG_variable
357          Children:        DW_CHILDREN_no
358          Attributes:
359            - Attribute:       DW_AT_location
360              Form:            DW_FORM_exprloc
361            - Attribute:       DW_AT_name
362              Form:            DW_FORM_strp
363            - Attribute:       DW_AT_decl_file
364              Form:            DW_FORM_data1
365            - Attribute:       DW_AT_decl_line
366              Form:            DW_FORM_data1
367            - Attribute:       DW_AT_type
368              Form:            DW_FORM_ref4
369        - Code:            0x00000007
370          Tag:             DW_TAG_const_type
371          Children:        DW_CHILDREN_no
372          Attributes:
373            - Attribute:       DW_AT_type
374              Form:            DW_FORM_ref4
375...
376
377#CHECK: DWARF:
378#CHECK:   debug_str:
379#CHECK:     - 'clang version 4.0.0 (trunk 290181) (llvm/trunk 290209)'
380#CHECK:     - '../compiler-rt/lib/builtins/absvdi2.c'
381#CHECK:     - '/Users/cbieneman/dev/open-source/llvm-build-rel'
382#CHECK:     - int
383#CHECK:     - di_int
384#CHECK:     - long long int
385#CHECK:     - __absvdi2
386#CHECK:     - a
387#CHECK:     - N
388#CHECK:     - t
389#CHECK:   debug_abbrev:
390#CHECK:     - Code:            0x1
391#CHECK:       Tag:             DW_TAG_compile_unit
392#CHECK:       Children:        DW_CHILDREN_yes
393#CHECK:       Attributes:
394#CHECK:         - Attribute:       DW_AT_producer
395#CHECK:           Form:            DW_FORM_strp
396#CHECK:         - Attribute:       DW_AT_language
397#CHECK:           Form:            DW_FORM_data2
398#CHECK:         - Attribute:       DW_AT_name
399#CHECK:           Form:            DW_FORM_strp
400#CHECK:         - Attribute:       DW_AT_stmt_list
401#CHECK:           Form:            DW_FORM_sec_offset
402#CHECK:         - Attribute:       DW_AT_comp_dir
403#CHECK:           Form:            DW_FORM_strp
404#CHECK:         - Attribute:       DW_AT_low_pc
405#CHECK:           Form:            DW_FORM_addr
406#CHECK:         - Attribute:       DW_AT_high_pc
407#CHECK:           Form:            DW_FORM_data4
408#CHECK:     - Code:            0x2
409#CHECK:       Tag:             DW_TAG_base_type
410#CHECK:       Children:        DW_CHILDREN_no
411#CHECK:       Attributes:
412#CHECK:         - Attribute:       DW_AT_name
413#CHECK:           Form:            DW_FORM_strp
414#CHECK:         - Attribute:       DW_AT_encoding
415#CHECK:           Form:            DW_FORM_data1
416#CHECK:         - Attribute:       DW_AT_byte_size
417#CHECK:           Form:            DW_FORM_data1
418#CHECK:     - Code:            0x3
419#CHECK:       Tag:             DW_TAG_typedef
420#CHECK:       Children:        DW_CHILDREN_no
421#CHECK:       Attributes:
422#CHECK:         - Attribute:       DW_AT_type
423#CHECK:           Form:            DW_FORM_ref4
424#CHECK:         - Attribute:       DW_AT_name
425#CHECK:           Form:            DW_FORM_strp
426#CHECK:         - Attribute:       DW_AT_decl_file
427#CHECK:           Form:            DW_FORM_data1
428#CHECK:         - Attribute:       DW_AT_decl_line
429#CHECK:           Form:            DW_FORM_data1
430#CHECK:     - Code:            0x4
431#CHECK:       Tag:             DW_TAG_subprogram
432#CHECK:       Children:        DW_CHILDREN_yes
433#CHECK:       Attributes:
434#CHECK:         - Attribute:       DW_AT_low_pc
435#CHECK:           Form:            DW_FORM_addr
436#CHECK:         - Attribute:       DW_AT_high_pc
437#CHECK:           Form:            DW_FORM_data4
438#CHECK:         - Attribute:       DW_AT_frame_base
439#CHECK:           Form:            DW_FORM_exprloc
440#CHECK:         - Attribute:       DW_AT_name
441#CHECK:           Form:            DW_FORM_strp
442#CHECK:         - Attribute:       DW_AT_decl_file
443#CHECK:           Form:            DW_FORM_data1
444#CHECK:         - Attribute:       DW_AT_decl_line
445#CHECK:           Form:            DW_FORM_data1
446#CHECK:         - Attribute:       DW_AT_prototyped
447#CHECK:           Form:            DW_FORM_flag_present
448#CHECK:         - Attribute:       DW_AT_type
449#CHECK:           Form:            DW_FORM_ref4
450#CHECK:         - Attribute:       DW_AT_external
451#CHECK:           Form:            DW_FORM_flag_present
452#CHECK:     - Code:            0x5
453#CHECK:       Tag:             DW_TAG_formal_parameter
454#CHECK:       Children:        DW_CHILDREN_no
455#CHECK:       Attributes:
456#CHECK:         - Attribute:       DW_AT_location
457#CHECK:           Form:            DW_FORM_exprloc
458#CHECK:         - Attribute:       DW_AT_name
459#CHECK:           Form:            DW_FORM_strp
460#CHECK:         - Attribute:       DW_AT_decl_file
461#CHECK:           Form:            DW_FORM_data1
462#CHECK:         - Attribute:       DW_AT_decl_line
463#CHECK:           Form:            DW_FORM_data1
464#CHECK:         - Attribute:       DW_AT_type
465#CHECK:           Form:            DW_FORM_ref4
466#CHECK:     - Code:            0x6
467#CHECK:       Tag:             DW_TAG_variable
468#CHECK:       Children:        DW_CHILDREN_no
469#CHECK:       Attributes:
470#CHECK:         - Attribute:       DW_AT_location
471#CHECK:           Form:            DW_FORM_exprloc
472#CHECK:         - Attribute:       DW_AT_name
473#CHECK:           Form:            DW_FORM_strp
474#CHECK:         - Attribute:       DW_AT_decl_file
475#CHECK:           Form:            DW_FORM_data1
476#CHECK:         - Attribute:       DW_AT_decl_line
477#CHECK:           Form:            DW_FORM_data1
478#CHECK:         - Attribute:       DW_AT_type
479#CHECK:           Form:            DW_FORM_ref4
480#CHECK:     - Code:            0x7
481#CHECK:       Tag:             DW_TAG_const_type
482#CHECK:       Children:        DW_CHILDREN_no
483#CHECK:       Attributes:
484#CHECK:         - Attribute:       DW_AT_type
485#CHECK:          Form:            DW_FORM_ref4
486
487