[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / test / tools / llvm-objcopy / MachO / linkedit-order-2.test
blob0c5521ece0e444af054d6ea68ebe07d0f5bda0c6
1 ## This test verifies that the linkedit segment is
2 ## laid out in the right order.
4 # RUN: yaml2obj %s -o %t.original
5 # RUN: llvm-objcopy %t.original %t.copy
6 # RUN: obj2yaml %t.copy > %t.yaml
7 ## Print the results several times in order to capture the linkedit offsets
8 ## in the order they are needed, but still following the order of the load
9 ## commands where they appear.
10 # RUN: cat %t.yaml %t.yaml %t.yaml | FileCheck %s
12 # CHECK: cmd:             LC_SEGMENT_64
13 # CHECK: segname:         __LINKEDIT
14 # CHECK: fileoff:         [[#LINKEDIT_FILEOFF:]]
15 # CHECK: filesize:        [[#LINKEDIT_FILESIZE:]]
17 # CHECK: cmd:             LC_DYLD_CHAINED_FIXUPS
18 # CHECK: dataoff:         [[#CHAINED_FIXUPS_FILEOFF: LINKEDIT_FILEOFF]]
19 # CHECK: datasize:        [[#CHAINED_FIXUPS_FILESIZE:]]
21 # CHECK: cmd:             LC_DYLD_EXPORTS_TRIE
22 # CHECK: dataoff:         [[#DYLD_EXPORTS_TRIE_FILEOFF: CHAINED_FIXUPS_FILEOFF + CHAINED_FIXUPS_FILESIZE]]
23 # CHECK: datasize:        [[#DYLD_EXPORTS_TRIE_FILESIZE:]]
25 ## Jump over LC_SYMTAB and LC_DYSYMTAB, which will be checked during
26 ## later.
28 # CHECK: cmd:             LC_FUNCTION_STARTS
29 # CHECK: dataoff:         [[#FUNCTION_STARTS_FILEOFF: DYLD_EXPORTS_TRIE_FILEOFF + DYLD_EXPORTS_TRIE_FILESIZE]]
30 # CHECK: datasize:        [[#FUNCTION_STARTS_FILESIZE:]]
32 # CHECK: cmd:             LC_DATA_IN_CODE
33 # CHECK: dataoff:         [[#DATA_IN_CODE_FILEOFF: FUNCTION_STARTS_FILEOFF + FUNCTION_STARTS_FILESIZE]]
34 # CHECK: datasize:        [[#DATA_IN_CODE_FILESIZE:]]
36 ## Jump over LC_CODE_SIGNATURE, which needs to be checked last
38 # CHECK: --- !mach-o
40 # CHECK: cmd:             LC_SYMTAB
41 # CHECK: symoff:          [[#SYMTAB_SYMOFF: DATA_IN_CODE_FILEOFF + DATA_IN_CODE_FILESIZE]]
42 # CHECK: nsyms:           [[#SYMTAB_NSYMS:]]
44 ## Skip over the strings table offset/size (part of LC_SYMTAB) until next loop.
46 # CHECK: cmd:             LC_DYSYMTAB
47 # CHECK: indirectsymoff:  [[#DYSYMTAB_INDIRECTSYMOFF: SYMTAB_SYMOFF + mul(SYMTAB_NSYMS, 16)]]
48 # CHECK: nindirectsyms:   [[#DYSYMTAB_NINDIRECTSYMS:]]
50 # CHECK: --- !mach-o
52 # CHECK: cmd:             LC_SYMTAB
53 # CHECK: stroff:          [[#SYMTAB_STROFF: DYSYMTAB_INDIRECTSYMOFF + mul(DYSYMTAB_NINDIRECTSYMS, 4)]]
54 # CHECK: strsize:         [[#SYMTAB_STRSIZE:]]
56 # CHECK: cmd:             LC_CODE_SIGNATURE
57 ## LC_CODE_SIGNATURE needs to be aligned to 16 bytes boundaries.
58 # CHECK: dataoff:         [[#CODE_SIGNATURE_FILEOFF: mul(div(SYMTAB_STROFF + SYMTAB_STRSIZE + 8, 16), 16)]]
59 # CHECK: datasize:        [[#CODE_SIGNATURE_FILESIZE:LINKEDIT_FILEOFF + LINKEDIT_FILESIZE - CODE_SIGNATURE_FILEOFF]]
61 --- !mach-o
62 FileHeader:
63   magic:           0xFEEDFACF
64   cputype:         0x1000007
65   cpusubtype:      0x3
66   filetype:        0x2
67   ncmds:           18
68   sizeofcmds:      1032
69   flags:           0x210085
70   reserved:        0x0
71 LoadCommands:
72   - cmd:             LC_SEGMENT_64
73     cmdsize:         72
74     segname:         __PAGEZERO
75     vmaddr:          0
76     vmsize:          4294967296
77     fileoff:         0
78     filesize:        0
79     maxprot:         0
80     initprot:        0
81     nsects:          0
82     flags:           0
83   - cmd:             LC_SEGMENT_64
84     cmdsize:         312
85     segname:         __TEXT
86     vmaddr:          4294967296
87     vmsize:          16384
88     fileoff:         0
89     filesize:        16384
90     maxprot:         5
91     initprot:        5
92     nsects:          3
93     flags:           0
94     Sections:
95       - sectname:        __text
96         segname:         __TEXT
97         addr:            0x100003F9C
98         size:            16
99         offset:          0x3F9C
100         align:           2
101         reloff:          0x0
102         nreloc:          0
103         flags:           0x80000400
104         reserved1:       0x0
105         reserved2:       0x0
106         reserved3:       0x0
107         content:         E80B000000E80C000000C39000000000
108       - sectname:        __stubs
109         segname:         __TEXT
110         addr:            0x100003FAC
111         size:            12
112         offset:          0x3FAC
113         align:           1
114         reloff:          0x0
115         nreloc:          0
116         flags:           0x80000408
117         reserved1:       0x0
118         reserved2:       0x6
119         reserved3:       0x0
120         content:         FF254E000000FF2550000000
121       - sectname:        __unwind_info
122         segname:         __TEXT
123         addr:            0x100003FB8
124         size:            72
125         offset:          0x3FB8
126         align:           2
127         reloff:          0x0
128         nreloc:          0
129         flags:           0x0
130         reserved1:       0x0
131         reserved2:       0x0
132         reserved3:       0x0
133         content:         010000001C000000000000001C000000000000001C000000020000009C3F00003400000034000000AD3F00000000000034000000030000000C000100100001000000000000000000
134   - cmd:             LC_SEGMENT_64
135     cmdsize:         152
136     segname:         __DATA_CONST
137     vmaddr:          4294983680
138     vmsize:          16384
139     fileoff:         16384
140     filesize:        16384
141     maxprot:         3
142     initprot:        3
143     nsects:          1
144     flags:           16
145     Sections:
146       - sectname:        __got
147         segname:         __DATA_CONST
148         addr:            0x100004000
149         size:            16
150         offset:          0x4000
151         align:           3
152         reloff:          0x0
153         nreloc:          0
154         flags:           0x6
155         reserved1:       0x2
156         reserved2:       0x0
157         reserved3:       0x0
158         content:         '00000000000010800100000000000080'
159   - cmd:             LC_SEGMENT_64
160     cmdsize:         72
161     segname:         __LINKEDIT
162     vmaddr:          4295000064
163     vmsize:          16384
164     fileoff:         32768
165     filesize:        719
166     maxprot:         1
167     initprot:        1
168     nsects:          0
169     flags:           0
170   - cmd:             LC_DYLD_CHAINED_FIXUPS
171     cmdsize:         16
172     dataoff:         32768
173     datasize:        104
174   - cmd:             LC_DYLD_EXPORTS_TRIE
175     cmdsize:         16
176     dataoff:         32872
177     datasize:        48
178   - cmd:             LC_SYMTAB
179     cmdsize:         24
180     symoff:          32936
181     nsyms:           4
182     stroff:          33016
183     strsize:         48
184   - cmd:             LC_DYSYMTAB
185     cmdsize:         80
186     ilocalsym:       0
187     nlocalsym:       0
188     iextdefsym:      0
189     nextdefsym:      2
190     iundefsym:       2
191     nundefsym:       2
192     tocoff:          0
193     ntoc:            0
194     modtaboff:       0
195     nmodtab:         0
196     extrefsymoff:    0
197     nextrefsyms:     0
198     indirectsymoff:  33000
199     nindirectsyms:   4
200     extreloff:       0
201     nextrel:         0
202     locreloff:       0
203     nlocrel:         0
204   - cmd:             LC_LOAD_DYLINKER
205     cmdsize:         32
206     name:            12
207     Content:         '/usr/lib/dyld'
208     ZeroPadBytes:    7
209   - cmd:             LC_UUID
210     cmdsize:         24
211     uuid:            F74FD957-51B1-3D8E-AE70-D8A248BB5D93
212   - cmd:             LC_BUILD_VERSION
213     cmdsize:         32
214     platform:        1
215     minos:           786432
216     sdk:             787200
217     ntools:          1
218     Tools:
219       - tool:            3
220         version:         50069504
221   - cmd:             LC_SOURCE_VERSION
222     cmdsize:         16
223     version:         0
224   - cmd:             LC_MAIN
225     cmdsize:         24
226     entryoff:        16284
227     stacksize:       0
228   - cmd:             LC_LOAD_DYLIB
229     cmdsize:         56
230     dylib:
231       name:            24
232       timestamp:       2
233       current_version: 0
234       compatibility_version: 0
235     Content:         libFoo-chained-fixups.dylib
236     ZeroPadBytes:    5
237   - cmd:             LC_LOAD_DYLIB
238     cmdsize:         56
239     dylib:
240       name:            24
241       timestamp:       2
242       current_version: 85943299
243       compatibility_version: 65536
244     Content:         '/usr/lib/libSystem.B.dylib'
245     ZeroPadBytes:    6
246   - cmd:             LC_FUNCTION_STARTS
247     cmdsize:         16
248     dataoff:         32920
249     datasize:        8
250   - cmd:             LC_DATA_IN_CODE
251     cmdsize:         16
252     dataoff:         32928
253     datasize:        8
254   - cmd:             LC_CODE_SIGNATURE
255     cmdsize:         16
256     dataoff:         33072
257     datasize:        415
258 LinkEditData:
259   ExportTrie:
260     TerminalSize:    0
261     NodeOffset:      0
262     Name:            ''
263     Flags:           0x0
264     Address:         0x0
265     Other:           0x0
266     ImportName:      ''
267     Children:
268       - TerminalSize:    0
269         NodeOffset:      5
270         Name:            _
271         Flags:           0x0
272         Address:         0x0
273         Other:           0x0
274         ImportName:      ''
275         Children:
276           - TerminalSize:    2
277             NodeOffset:      33
278             Name:            _mh_execute_header
279             Flags:           0x0
280             Address:         0x0
281             Other:           0x0
282             ImportName:      ''
283           - TerminalSize:    3
284             NodeOffset:      37
285             Name:            main
286             Flags:           0x0
287             Address:         0x3F9C
288             Other:           0x0
289             ImportName:      ''
290   NameList:
291     - n_strx:          2
292       n_type:          0xF
293       n_sect:          1
294       n_desc:          16
295       n_value:         4294967296
296     - n_strx:          22
297       n_type:          0xF
298       n_sect:          1
299       n_desc:          0
300       n_value:         4294983580
301     - n_strx:          28
302       n_type:          0x1
303       n_sect:          0
304       n_desc:          256
305       n_value:         0
306     - n_strx:          33
307       n_type:          0x1
308       n_sect:          0
309       n_desc:          384
310       n_value:         0
311   StringTable:
312     - ' '
313     - __mh_execute_header
314     - _main
315     - _foo
316     - _weak_foo
317     - ''
318     - ''
319     - ''
320     - ''
321     - ''
322   IndirectSymbols: [ 0x2, 0x3, 0x2, 0x3 ]
323   FunctionStarts:  [ 0x3F9C ]
324   ChainedFixups:   [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x50, 0x0,
325                      0x0, 0x0, 0x58, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0,
326                      0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
327                      0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
328                      0x0, 0x0, 0x0, 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x0,
329                      0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x0, 0x0, 0x0,
330                      0x0, 0x10, 0x6, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0,
331                      0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
332                      0x1, 0x2, 0x0, 0x0, 0xFD, 0xC, 0x0, 0x0, 0x0, 0x5F,
333                      0x66, 0x6F, 0x6F, 0x0, 0x5F, 0x77, 0x65, 0x61, 0x6B,
334                      0x5F, 0x66, 0x6F, 0x6F, 0x0 ]
335   DataInCode:
336     - Offset:          0x3FA8
337       Length:          4
338       Kind:            0x4