[Alignment][NFC] Instructions::getLoadStoreAlignment
[llvm-complete.git] / test / tools / llvm-objcopy / MachO / basic-executable-copy.test
blob85eebad287092801e91d82da9d6ed88a8290ed96
1 ## This test verifies that llvm-objcopy copies an executable properly. It
2 ## uses llvm-readobj instead of cmp because some parts of the object
3 ## (e.g., the string table) are not identical; the output file is correct but
4 ## some offsets differ from the input file.
5 # RUN: yaml2obj %s > %t
6 # RUN: llvm-objcopy %t %t2
7 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s
9 --- !mach-o
10 FileHeader:
11   magic:           0xFEEDFACF
12   cputype:         0x01000007
13   cpusubtype:      0x80000003
14   filetype:        0x00000002
15   ncmds:           15
16   sizeofcmds:      976
17   flags:           0x00200085
18   reserved:        0x00000000
19 LoadCommands:
20   - cmd:             LC_SEGMENT_64
21     cmdsize:         72
22     segname:         __PAGEZERO
23     vmaddr:          0
24     vmsize:          4294967296
25     fileoff:         0
26     filesize:        0
27     maxprot:         0
28     initprot:        0
29     nsects:          0
30     flags:           0
31   - cmd:             LC_SEGMENT_64
32     cmdsize:         232
33     segname:         __TEXT
34     vmaddr:          4294967296
35     vmsize:          4096
36     fileoff:         0
37     filesize:        4096
38     maxprot:         7
39     initprot:        5
40     nsects:          2
41     flags:           0
42     Sections:
43       - sectname:        __text
44         segname:         __TEXT
45         addr:            0x0000000100000F70
46         size:            58
47         offset:          0x00000F70
48         align:           4
49         reloff:          0x00000000
50         nreloc:          0
51         flags:           0x80000400
52         reserved1:       0x00000000
53         reserved2:       0x00000000
54         reserved3:       0x00000000
55       - sectname:        __unwind_info
56         segname:         __TEXT
57         addr:            0x0000000100000FAC
58         size:            72
59         offset:          0x00000FAC
60         align:           2
61         reloff:          0x00000000
62         nreloc:          0
63         flags:           0x00000000
64         reserved1:       0x00000000
65         reserved2:       0x00000000
66         reserved3:       0x00000000
67   - cmd:             LC_SEGMENT_64
68     cmdsize:         232
69     segname:         __DATA
70     vmaddr:          4294971392
71     vmsize:          4096
72     fileoff:         4096
73     filesize:        4096
74     maxprot:         7
75     initprot:        3
76     nsects:          2
77     flags:           0
78     Sections:
79       - sectname:        __data
80         segname:         __DATA
81         addr:            0x0000000100001000
82         size:            4
83         offset:          0x00001000
84         align:           2
85         reloff:          0x00000000
86         nreloc:          0
87         flags:           0x00000000
88         reserved1:       0x00000000
89         reserved2:       0x00000000
90         reserved3:       0x00000000
91       - sectname:        __common
92         segname:         __DATA
93         addr:            0x0000000100001004
94         size:            4
95         offset:          0x00000000
96         align:           2
97         reloff:          0x00000000
98         nreloc:          0
99         flags:           0x00000001
100         reserved1:       0x00000000
101         reserved2:       0x00000000
102         reserved3:       0x00000000
103   - cmd:             LC_SEGMENT_64
104     cmdsize:         72
105     segname:         __LINKEDIT
106     vmaddr:          4294975488
107     vmsize:          4096
108     fileoff:         8192
109     filesize:        232
110     maxprot:         7
111     initprot:        1
112     nsects:          0
113     flags:           0
114   - cmd:             LC_DYLD_INFO_ONLY
115     cmdsize:         48
116     rebase_off:      0
117     rebase_size:     0
118     bind_off:        0
119     bind_size:       0
120     weak_bind_off:   0
121     weak_bind_size:  0
122     lazy_bind_off:   0
123     lazy_bind_size:  0
124     export_off:      8192
125     export_size:     72
126   - cmd:             LC_SYMTAB
127     cmdsize:         24
128     symoff:          8272
129     nsyms:           6
130     stroff:          8368
131     strsize:         56
132   - cmd:             LC_DYSYMTAB
133     cmdsize:         80
134     ilocalsym:       0
135     nlocalsym:       0
136     iextdefsym:      0
137     nextdefsym:      5
138     iundefsym:       5
139     nundefsym:       1
140     tocoff:          0
141     ntoc:            0
142     modtaboff:       0
143     nmodtab:         0
144     extrefsymoff:    0
145     nextrefsyms:     0
146     indirectsymoff:  0
147     nindirectsyms:   0
148     extreloff:       0
149     nextrel:         0
150     locreloff:       0
151     nlocrel:         0
152   - cmd:             LC_LOAD_DYLINKER
153     cmdsize:         32
154     name:            12
155     PayloadString:   '/usr/lib/dyld'
156     ZeroPadBytes:    7
157   - cmd:             LC_UUID
158     cmdsize:         24
159     uuid:            B6EE4FB7-4E1E-3C7A-80D3-CFBD89DBC0FE
160   - cmd:             LC_BUILD_VERSION
161     cmdsize:         32
162     platform:        1
163     minos:           658944
164     sdk:             658944
165     ntools:          1
166     Tools:
167       - tool:            3
168         version:         29491968
169   - cmd:             LC_SOURCE_VERSION
170     cmdsize:         16
171     version:         0
172   - cmd:             LC_MAIN
173     cmdsize:         24
174     entryoff:        3984
175     stacksize:       0
176   - cmd:             LC_LOAD_DYLIB
177     cmdsize:         56
178     dylib:
179       name:            24
180       timestamp:       2
181       current_version: 82115073
182       compatibility_version: 65536
183     PayloadString:   '/usr/lib/libSystem.B.dylib'
184     ZeroPadBytes:    6
185   - cmd:             LC_FUNCTION_STARTS
186     cmdsize:         16
187     dataoff:         8264
188     datasize:        8
189   - cmd:             LC_DATA_IN_CODE
190     cmdsize:         16
191     dataoff:         8272
192     datasize:        0
193 LinkEditData:
194   ExportTrie:
195     TerminalSize:    0
196     NodeOffset:      0
197     Name:            ''
198     Flags:           0x0000000000000000
199     Address:         0x0000000000000000
200     Other:           0x0000000000000000
201     ImportName:      ''
202     Children:
203       - TerminalSize:    0
204         NodeOffset:      5
205         Name:            _
206         Flags:           0x0000000000000000
207         Address:         0x0000000000000000
208         Other:           0x0000000000000000
209         ImportName:      ''
210         Children:
211           - TerminalSize:    2
212             NodeOffset:      44
213             Name:            _mh_execute_header
214             Flags:           0x0000000000000000
215             Address:         0x0000000000000000
216             Other:           0x0000000000000000
217             ImportName:      ''
218           - TerminalSize:    3
219             NodeOffset:      48
220             Name:            foo
221             Flags:           0x0000000000000000
222             Address:         0x0000000000000F70
223             Other:           0x0000000000000000
224             ImportName:      ''
225           - TerminalSize:    3
226             NodeOffset:      53
227             Name:            main
228             Flags:           0x0000000000000000
229             Address:         0x0000000000000F90
230             Other:           0x0000000000000000
231             ImportName:      ''
232           - TerminalSize:    3
233             NodeOffset:      58
234             Name:            b
235             Flags:           0x0000000000000000
236             Address:         0x0000000000001000
237             Other:           0x0000000000000000
238             ImportName:      ''
239           - TerminalSize:    3
240             NodeOffset:      63
241             Name:            a
242             Flags:           0x0000000000000000
243             Address:         0x0000000000001004
244             Other:           0x0000000000000000
245             ImportName:      ''
246   NameList:
247     - n_strx:          2
248       n_type:          0x0F
249       n_sect:          1
250       n_desc:          16
251       n_value:         4294967296
252     - n_strx:          22
253       n_type:          0x0F
254       n_sect:          4
255       n_desc:          0
256       n_value:         4294971396
257     - n_strx:          25
258       n_type:          0x0F
259       n_sect:          3
260       n_desc:          0
261       n_value:         4294971392
262     - n_strx:          28
263       n_type:          0x0F
264       n_sect:          1
265       n_desc:          0
266       n_value:         4294971248
267     - n_strx:          33
268       n_type:          0x0F
269       n_sect:          1
270       n_desc:          0
271       n_value:         4294971280
272     - n_strx:          39
273       n_type:          0x01
274       n_sect:          0
275       n_desc:          256
276       n_value:         0
277   StringTable:
278     - ' '
279     - __mh_execute_header
280     - _a
281     - _b
282     - _foo
283     - _main
284     - dyld_stub_binder
287 # CHECK: FileType: Executable (0x2)
288 # CHECK: Name: __text
289 # CHECK: Name: __unwind_info
290 # CHECK: Name: __data
291 # CHECK: Name: __common