1# RUN: yaml2obj %s | obj2yaml | FileCheck %s
2
3--- !mach-o
4FileHeader:      
5  magic:           0xFEEDFACF
6  cputype:         0x01000007
7  cpusubtype:      0x80000003
8  filetype:        0x00000002
9  ncmds:           16
10  sizeofcmds:      1408
11  flags:           0x00218085
12  reserved:        0x00000000
13LoadCommands:    
14  - cmd:             LC_SEGMENT_64
15    cmdsize:         72
16    segname:         __PAGEZERO
17    vmaddr:          0
18    vmsize:          4294967296
19    fileoff:         0
20    filesize:        0
21    maxprot:         0
22    initprot:        0
23    nsects:          0
24    flags:           0
25  - cmd:             LC_SEGMENT_64
26    cmdsize:         552
27    segname:         __TEXT
28    vmaddr:          4294967296
29    vmsize:          8192
30    fileoff:         0
31    filesize:        8192
32    maxprot:         7
33    initprot:        5
34    nsects:          6
35    flags:           0
36  - cmd:             LC_SEGMENT_64
37    cmdsize:         312
38    segname:         __DATA
39    vmaddr:          4294975488
40    vmsize:          4096
41    fileoff:         8192
42    filesize:        4096
43    maxprot:         7
44    initprot:        3
45    nsects:          3
46    flags:           0
47  - cmd:             LC_SEGMENT_64
48    cmdsize:         72
49    segname:         __LINKEDIT
50    vmaddr:          4294979584
51    vmsize:          4096
52    fileoff:         12288
53    filesize:        2508
54    maxprot:         7
55    initprot:        1
56    nsects:          0
57    flags:           0
58  - cmd:             LC_DYLD_INFO_ONLY
59    cmdsize:         48
60    rebase_off:      12384
61    rebase_size:     8
62    bind_off:        12288
63    bind_size:       96
64    weak_bind_off:   0
65    weak_bind_size:  0
66    lazy_bind_off:   12392
67    lazy_bind_size:  624
68    export_off:      13016
69    export_size:     48
70  - cmd:             LC_SYMTAB
71    cmdsize:         24
72    symoff:          13080
73    nsyms:           30
74    stroff:          13700
75    strsize:         1096
76  - cmd:             LC_DYSYMTAB
77    cmdsize:         80
78    ilocalsym:       0
79    nlocalsym:       9
80    iextdefsym:      9
81    nextdefsym:      2
82    iundefsym:       11
83    nundefsym:       19
84    tocoff:          0
85    ntoc:            0
86    modtaboff:       0
87    nmodtab:         0
88    extrefsymoff:    0
89    nextrefsyms:     0
90    indirectsymoff:  13560
91    nindirectsyms:   35
92    extreloff:       0
93    nextrel:         0
94    locreloff:       0
95    nlocrel:         0
96  - cmd:             LC_LOAD_DYLINKER
97    cmdsize:         32
98    name:            12
99    PayloadString:   /usr/lib/dyld
100    ZeroPadBytes:    7
101  - cmd:             LC_UUID
102    cmdsize:         24
103    uuid:            461A1B28-822F-3F38-B670-645419E636F5
104  - cmd:             LC_VERSION_MIN_MACOSX
105    cmdsize:         16
106    version:         658176
107    sdk:             658176
108  - cmd:             LC_SOURCE_VERSION
109    cmdsize:         16
110    version:         0
111  - cmd:             LC_MAIN
112    cmdsize:         24
113    entryoff:        4448
114    stacksize:       0
115  - cmd:             LC_LOAD_DYLIB
116    cmdsize:         48
117    dylib:           
118      name:            24
119      timestamp:       2
120      current_version: 7864576
121      compatibility_version: 65536
122    PayloadString:   '/usr/lib/libc++.1.dylib'
123    ZeroPadBytes:    1
124  - cmd:             LC_LOAD_DYLIB
125    cmdsize:         56
126    dylib:           
127      name:            24
128      timestamp:       2
129      current_version: 80349697
130      compatibility_version: 65536
131    PayloadString:   /usr/lib/libSystem.B.dylib
132    ZeroPadBytes:    6
133  - cmd:             LC_FUNCTION_STARTS
134    cmdsize:         16
135    dataoff:         13064
136    datasize:        16
137  - cmd:             LC_DATA_IN_CODE
138    cmdsize:         16
139    dataoff:         13080
140    datasize:        0
141LinkEditData:    
142  RebaseOpcodes:   
143    - Opcode:          REBASE_OPCODE_SET_TYPE_IMM
144      Imm:             1
145    - Opcode:          REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
146      Imm:             2
147      ExtraData:       
148        - 0x0000000000000028
149    - Opcode:          REBASE_OPCODE_DO_REBASE_ULEB_TIMES
150      Imm:             0
151      ExtraData:       
152        - 0x000000000000000F
153    - Opcode:          REBASE_OPCODE_DONE
154      Imm:             0
155  BindOpcodes:     
156    - Opcode:          BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
157      Imm:             1
158      Symbol:          ''
159    - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
160      Imm:             0
161      Symbol:          __ZNSt3__14coutE
162    - Opcode:          BIND_OPCODE_SET_TYPE_IMM
163      Imm:             1
164      Symbol:          ''
165    - Opcode:          BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
166      Imm:             2
167      ULEBExtraData:   
168        - 0x0000000000000000
169      Symbol:          ''
170    - Opcode:          BIND_OPCODE_DO_BIND
171      Imm:             0
172      Symbol:          ''
173    - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
174      Imm:             0
175      Symbol:          __ZNSt3__15ctypeIcE2idE
176    - Opcode:          BIND_OPCODE_DO_BIND
177      Imm:             0
178      Symbol:          ''
179    - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
180      Imm:             0
181      Symbol:          ___gxx_personality_v0
182    - Opcode:          BIND_OPCODE_DO_BIND
183      Imm:             0
184      Symbol:          ''
185    - Opcode:          BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
186      Imm:             2
187      Symbol:          ''
188    - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
189      Imm:             0
190      Symbol:          dyld_stub_binder
191    - Opcode:          BIND_OPCODE_DO_BIND
192      Imm:             0
193      Symbol:          ''
194    - Opcode:          BIND_OPCODE_DONE
195      Imm:             0
196      Symbol:          ''
197...
198
199#CHECK:   - cmd:             LC_DYLD_INFO_ONLY
200#CHECK:     cmdsize:         48
201#CHECK:     rebase_off:      12384
202#CHECK:     rebase_size:     8
203#CHECK:     bind_off:        12288
204#CHECK:     bind_size:       96
205#CHECK:     weak_bind_off:   0
206#CHECK:     weak_bind_size:  0
207#CHECK:     lazy_bind_off:   12392
208#CHECK:     lazy_bind_size:  624
209#CHECK:     export_off:      13016
210#CHECK:     export_size:     48
211#CHECK: LinkEditData:
212#CHECK:   RebaseOpcodes:
213#CHECK:     - Opcode:          REBASE_OPCODE_SET_TYPE_IMM
214#CHECK:       Imm:             1
215#CHECK:     - Opcode:          REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
216#CHECK:       Imm:             2
217#CHECK:       ExtraData:       [ 0x28 ]
218#CHECK:     - Opcode:          REBASE_OPCODE_DO_REBASE_ULEB_TIMES
219#CHECK:       Imm:             0
220#CHECK:       ExtraData:       [ 0xF ]
221#CHECK:     - Opcode:          REBASE_OPCODE_DONE
222#CHECK:       Imm:             0
223#CHECK:   BindOpcodes:
224#CHECK:     - Opcode:          BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
225#CHECK:       Imm:             1
226#CHECK:       Symbol:          ''
227#CHECK:     - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
228#CHECK:       Imm:             0
229#CHECK:       Symbol:          __ZNSt3__14coutE
230#CHECK:     - Opcode:          BIND_OPCODE_SET_TYPE_IMM
231#CHECK:       Imm:             1
232#CHECK:       Symbol:          ''
233#CHECK:     - Opcode:          BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
234#CHECK:       Imm:             2
235#CHECK:       ULEBExtraData:   [ 0x0 ]
236#CHECK:       Symbol:          ''
237#CHECK:     - Opcode:          BIND_OPCODE_DO_BIND
238#CHECK:       Imm:             0
239#CHECK:       Symbol:          ''
240#CHECK:     - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
241#CHECK:       Imm:             0
242#CHECK:       Symbol:          __ZNSt3__15ctypeIcE2idE
243#CHECK:     - Opcode:          BIND_OPCODE_DO_BIND
244#CHECK:       Imm:             0
245#CHECK:       Symbol:          ''
246#CHECK:     - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
247#CHECK:       Imm:             0
248#CHECK:       Symbol:          ___gxx_personality_v0
249#CHECK:     - Opcode:          BIND_OPCODE_DO_BIND
250#CHECK:       Imm:             0
251#CHECK:       Symbol:          ''
252#CHECK:     - Opcode:          BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
253#CHECK:       Imm:             2
254#CHECK:       Symbol:          ''
255#CHECK:     - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
256#CHECK:       Imm:             0
257#CHECK:       Symbol:          dyld_stub_binder
258#CHECK:     - Opcode:          BIND_OPCODE_DO_BIND
259#CHECK:       Imm:             0
260#CHECK:       Symbol:          ''
261#CHECK:     - Opcode:          BIND_OPCODE_DONE
262#CHECK:       Imm:             0
263#CHECK:       Symbol:          ''
264