1RUN: llvm-readobj -h %p/Inputs/macho-universal.x86_64.i386 \
2RUN: | FileCheck %s -check-prefix MULTIHEADER
3
4RUN: llvm-readobj -sections %p/Inputs/macho-universal.x86_64.i386 \
5RUN: | FileCheck %s -check-prefix MULTISECTIONS
6
7RUN: llvm-readobj -h %p/Inputs/macho-universal-archive.x86_64.i386 \
8RUN: | FileCheck %s -check-prefix MULTIHEADER-ARCHIVE
9
10RUN: llvm-readobj -sections %p/Inputs/macho-universal-archive.x86_64.i386 \
11RUN: | FileCheck %s -check-prefix MULTISECTIONS-ARCHIVE
12
13MULTIHEADER: Format: Mach-O 64-bit x86-64
14MULTIHEADER: Arch: x86_64
15MULTIHEADER: AddressSize: 64bit
16MULTIHEADER: MachHeader {
17MULTIHEADER:   Magic: Magic64 (0xFEEDFACF)
18MULTIHEADER:   CpuType: X86-64 (0x1000007)
19MULTIHEADER:   CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
20MULTIHEADER:   FileType: Executable (0x2)
21MULTIHEADER:   NumOfLoadCommands: 16
22MULTIHEADER:   SizeOfLoadCommands: 880
23MULTIHEADER:   Flags [ (0x200085)
24MULTIHEADER:     MH_DYLDLINK (0x4)
25MULTIHEADER:     MH_NOUNDEFS (0x1)
26MULTIHEADER:     MH_PIE (0x200000)
27MULTIHEADER:     MH_TWOLEVEL (0x80)
28MULTIHEADER:   ]
29MULTIHEADER:   Reserved: 0x0
30MULTIHEADER: }
31
32MULTIHEADER: Format: Mach-O 32-bit i386
33MULTIHEADER: Arch: i386
34MULTIHEADER: AddressSize: 32bit
35MULTIHEADER: MachHeader {
36MULTIHEADER:   Magic: Magic (0xFEEDFACE)
37MULTIHEADER:   CpuType: X86 (0x7)
38MULTIHEADER:   CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
39MULTIHEADER:   FileType: Executable (0x2)
40MULTIHEADER:   NumOfLoadCommands: 16
41MULTIHEADER:   SizeOfLoadCommands: 716
42MULTIHEADER:   Flags [ (0x1200085)
43MULTIHEADER:     MH_DYLDLINK (0x4)
44MULTIHEADER:     MH_NOUNDEFS (0x1)
45MULTIHEADER:     MH_NO_HEAP_EXECUTION (0x1000000)
46MULTIHEADER:     MH_PIE (0x200000)
47MULTIHEADER:     MH_TWOLEVEL (0x80)
48MULTIHEADER:   ]
49MULTIHEADER: }
50
51
52
53MULTISECTIONS: Format: Mach-O 64-bit x86-64
54MULTISECTIONS: Arch: x86_64
55MULTISECTIONS: AddressSize: 64bit
56MULTISECTIONS: Sections [
57MULTISECTIONS:   Section {
58MULTISECTIONS:     Index: 0
59MULTISECTIONS:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
60MULTISECTIONS:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
61MULTISECTIONS:     Address: 0x100000F60
62MULTISECTIONS:     Size: 0x12
63MULTISECTIONS:     Offset: 3936
64MULTISECTIONS:     Alignment: 4
65MULTISECTIONS:     RelocationOffset: 0x0
66MULTISECTIONS:     RelocationCount: 0
67MULTISECTIONS:     Type: 0x0
68MULTISECTIONS:     Attributes [ (0x800004)
69MULTISECTIONS:       PureInstructions (0x800000)
70MULTISECTIONS:       SomeInstructions (0x4)
71MULTISECTIONS:     ]
72MULTISECTIONS:     Reserved1: 0x0
73MULTISECTIONS:     Reserved2: 0x0
74MULTISECTIONS:   }
75MULTISECTIONS:   Section {
76MULTISECTIONS:     Index: 1
77MULTISECTIONS:     Name: __unwind_info (5F 5F 75 6E 77 69 6E 64 5F 69 6E 66 6F 00 00 00)
78MULTISECTIONS:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
79MULTISECTIONS:     Address: 0x100000F72
80MULTISECTIONS:     Size: 0x48
81MULTISECTIONS:     Offset: 3954
82MULTISECTIONS:     Alignment: 0
83MULTISECTIONS:     RelocationOffset: 0x0
84MULTISECTIONS:     RelocationCount: 0
85MULTISECTIONS:     Type: 0x0
86MULTISECTIONS:     Attributes [ (0x0)
87MULTISECTIONS:     ]
88MULTISECTIONS:     Reserved1: 0x0
89MULTISECTIONS:     Reserved2: 0x0
90MULTISECTIONS:   }
91MULTISECTIONS:   Section {
92MULTISECTIONS:     Index: 2
93MULTISECTIONS:     Name: __eh_frame (5F 5F 65 68 5F 66 72 61 6D 65 00 00 00 00 00 00)
94MULTISECTIONS:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
95MULTISECTIONS:     Address: 0x100000FC0
96MULTISECTIONS:     Size: 0x40
97MULTISECTIONS:     Offset: 4032
98MULTISECTIONS:     Alignment: 3
99MULTISECTIONS:     RelocationOffset: 0x0
100MULTISECTIONS:     RelocationCount: 0
101MULTISECTIONS:     Type: 0x0
102MULTISECTIONS:     Attributes [ (0x0)
103MULTISECTIONS:     ]
104MULTISECTIONS:     Reserved1: 0x0
105MULTISECTIONS:     Reserved2: 0x0
106MULTISECTIONS:   }
107MULTISECTIONS: ]
108
109MULTISECTIONS: Format: Mach-O 32-bit i386
110MULTISECTIONS: Arch: i386
111MULTISECTIONS: AddressSize: 32bit
112MULTISECTIONS: Sections [
113MULTISECTIONS:   Section {
114MULTISECTIONS:     Index: 0
115MULTISECTIONS:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
116MULTISECTIONS:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
117MULTISECTIONS:     Address: 0x1FA0
118MULTISECTIONS:     Size: 0x15
119MULTISECTIONS:     Offset: 4000
120MULTISECTIONS:     Alignment: 4
121MULTISECTIONS:     RelocationOffset: 0x0
122MULTISECTIONS:     RelocationCount: 0
123MULTISECTIONS:     Type: 0x0
124MULTISECTIONS:     Attributes [ (0x800004)
125MULTISECTIONS:       PureInstructions (0x800000)
126MULTISECTIONS:       SomeInstructions (0x4)
127MULTISECTIONS:     ]
128MULTISECTIONS:     Reserved1: 0x0
129MULTISECTIONS:     Reserved2: 0x0
130MULTISECTIONS:   }
131MULTISECTIONS:   Section {
132MULTISECTIONS:     Index: 1
133MULTISECTIONS:     Name: __unwind_info (5F 5F 75 6E 77 69 6E 64 5F 69 6E 66 6F 00 00 00)
134MULTISECTIONS:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
135MULTISECTIONS:     Address: 0x1FB5
136MULTISECTIONS:     Size: 0x48
137MULTISECTIONS:     Offset: 4021
138MULTISECTIONS:     Alignment: 0
139MULTISECTIONS:     RelocationOffset: 0x0
140MULTISECTIONS:     RelocationCount: 0
141MULTISECTIONS:     Type: 0x0
142MULTISECTIONS:     Attributes [ (0x0)
143MULTISECTIONS:     ]
144MULTISECTIONS:     Reserved1: 0x0
145MULTISECTIONS:     Reserved2: 0x0
146MULTISECTIONS:   }
147MULTISECTIONS: ]
148
149MULTIHEADER-ARCHIVE: File: hello.o
150MULTIHEADER-ARCHIVE: Format: Mach-O 64-bit x86-64
151MULTIHEADER-ARCHIVE: Arch: x86_64
152MULTIHEADER-ARCHIVE: AddressSize: 64bit
153MULTIHEADER-ARCHIVE: MachHeader {
154MULTIHEADER-ARCHIVE:   Magic: Magic64 (0xFEEDFACF)
155MULTIHEADER-ARCHIVE:   CpuType: X86-64 (0x1000007)
156MULTIHEADER-ARCHIVE:   CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
157MULTIHEADER-ARCHIVE:   FileType: Relocatable (0x1)
158MULTIHEADER-ARCHIVE:   NumOfLoadCommands: 3
159MULTIHEADER-ARCHIVE:   SizeOfLoadCommands: 496
160MULTIHEADER-ARCHIVE:   Flags [ (0x2000)
161MULTIHEADER-ARCHIVE:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
162MULTIHEADER-ARCHIVE:   ]
163MULTIHEADER-ARCHIVE:   Reserved: 0x0
164MULTIHEADER-ARCHIVE: }
165MULTIHEADER-ARCHIVE: File: foo.o
166MULTIHEADER-ARCHIVE: Format: Mach-O 32-bit i386
167MULTIHEADER-ARCHIVE: Arch: i386
168MULTIHEADER-ARCHIVE: AddressSize: 32bit
169MULTIHEADER-ARCHIVE: MachHeader {
170MULTIHEADER-ARCHIVE:   Magic: Magic (0xFEEDFACE)
171MULTIHEADER-ARCHIVE:   CpuType: X86 (0x7)
172MULTIHEADER-ARCHIVE:   CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
173MULTIHEADER-ARCHIVE:   FileType: Relocatable (0x1)
174MULTIHEADER-ARCHIVE:   NumOfLoadCommands: 3
175MULTIHEADER-ARCHIVE:   SizeOfLoadCommands: 296
176MULTIHEADER-ARCHIVE:   Flags [ (0x2000)
177MULTIHEADER-ARCHIVE:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
178MULTIHEADER-ARCHIVE:   ]
179MULTIHEADER-ARCHIVE: }
180
181MULTISECTIONS-ARCHIVE: File: hello.o
182MULTISECTIONS-ARCHIVE: Format: Mach-O 64-bit x86-64
183MULTISECTIONS-ARCHIVE: Arch: x86_64
184MULTISECTIONS-ARCHIVE: AddressSize: 64bit
185MULTISECTIONS-ARCHIVE: Sections [
186MULTISECTIONS-ARCHIVE:   Section {
187MULTISECTIONS-ARCHIVE:     Index: 0
188MULTISECTIONS-ARCHIVE:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
189MULTISECTIONS-ARCHIVE:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
190MULTISECTIONS-ARCHIVE:     Address: 0x0
191MULTISECTIONS-ARCHIVE:     Size: 0x3B
192MULTISECTIONS-ARCHIVE:     Offset: 528
193MULTISECTIONS-ARCHIVE:     Alignment: 4
194MULTISECTIONS-ARCHIVE:     RelocationOffset: 0x2B8
195MULTISECTIONS-ARCHIVE:     RelocationCount: 2
196MULTISECTIONS-ARCHIVE:     Type: 0x0
197MULTISECTIONS-ARCHIVE:     Attributes [ (0x800004)
198MULTISECTIONS-ARCHIVE:       PureInstructions (0x800000)
199MULTISECTIONS-ARCHIVE:       SomeInstructions (0x4)
200MULTISECTIONS-ARCHIVE:     ]
201MULTISECTIONS-ARCHIVE:     Reserved1: 0x0
202MULTISECTIONS-ARCHIVE:     Reserved2: 0x0
203MULTISECTIONS-ARCHIVE:   }
204MULTISECTIONS-ARCHIVE:   Section {
205MULTISECTIONS-ARCHIVE:     Index: 1
206MULTISECTIONS-ARCHIVE:     Name: __cstring (5F 5F 63 73 74 72 69 6E 67 00 00 00 00 00 00 00)
207MULTISECTIONS-ARCHIVE:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
208MULTISECTIONS-ARCHIVE:     Address: 0x3B
209MULTISECTIONS-ARCHIVE:     Size: 0xD
210MULTISECTIONS-ARCHIVE:     Offset: 587
211MULTISECTIONS-ARCHIVE:     Alignment: 0
212MULTISECTIONS-ARCHIVE:     RelocationOffset: 0x0
213MULTISECTIONS-ARCHIVE:     RelocationCount: 0
214MULTISECTIONS-ARCHIVE:     Type: ExtReloc (0x2)
215MULTISECTIONS-ARCHIVE:     Attributes [ (0x0)
216MULTISECTIONS-ARCHIVE:     ]
217MULTISECTIONS-ARCHIVE:     Reserved1: 0x0
218MULTISECTIONS-ARCHIVE:     Reserved2: 0x0
219MULTISECTIONS-ARCHIVE:   }
220MULTISECTIONS-ARCHIVE:   Section {
221MULTISECTIONS-ARCHIVE:     Index: 2
222MULTISECTIONS-ARCHIVE:     Name: __compact_unwind (5F 5F 63 6F 6D 70 61 63 74 5F 75 6E 77 69 6E 64)
223MULTISECTIONS-ARCHIVE:     Segment: __LD (5F 5F 4C 44 00 00 00 00 00 00 00 00 00 00 00 00)
224MULTISECTIONS-ARCHIVE:     Address: 0x48
225MULTISECTIONS-ARCHIVE:     Size: 0x20
226MULTISECTIONS-ARCHIVE:     Offset: 600
227MULTISECTIONS-ARCHIVE:     Alignment: 3
228MULTISECTIONS-ARCHIVE:     RelocationOffset: 0x2C8
229MULTISECTIONS-ARCHIVE:     RelocationCount: 1
230MULTISECTIONS-ARCHIVE:     Type: 0x0
231MULTISECTIONS-ARCHIVE:     Attributes [ (0x20000)
232MULTISECTIONS-ARCHIVE:       Debug (0x20000)
233MULTISECTIONS-ARCHIVE:     ]
234MULTISECTIONS-ARCHIVE:     Reserved1: 0x0
235MULTISECTIONS-ARCHIVE:     Reserved2: 0x0
236MULTISECTIONS-ARCHIVE:   }
237MULTISECTIONS-ARCHIVE:   Section {
238MULTISECTIONS-ARCHIVE:     Index: 3
239MULTISECTIONS-ARCHIVE:     Name: __eh_frame (5F 5F 65 68 5F 66 72 61 6D 65 00 00 00 00 00 00)
240MULTISECTIONS-ARCHIVE:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
241MULTISECTIONS-ARCHIVE:     Address: 0x68
242MULTISECTIONS-ARCHIVE:     Size: 0x40
243MULTISECTIONS-ARCHIVE:     Offset: 632
244MULTISECTIONS-ARCHIVE:     Alignment: 3
245MULTISECTIONS-ARCHIVE:     RelocationOffset: 0x0
246MULTISECTIONS-ARCHIVE:     RelocationCount: 0
247MULTISECTIONS-ARCHIVE:     Type: 0xB
248MULTISECTIONS-ARCHIVE:     Attributes [ (0x680000)
249MULTISECTIONS-ARCHIVE:       LiveSupport (0x80000)
250MULTISECTIONS-ARCHIVE:       NoTOC (0x400000)
251MULTISECTIONS-ARCHIVE:       StripStaticSyms (0x200000)
252MULTISECTIONS-ARCHIVE:     ]
253MULTISECTIONS-ARCHIVE:     Reserved1: 0x0
254MULTISECTIONS-ARCHIVE:     Reserved2: 0x0
255MULTISECTIONS-ARCHIVE:   }
256MULTISECTIONS-ARCHIVE: ]
257MULTISECTIONS-ARCHIVE: File: foo.o
258MULTISECTIONS-ARCHIVE: Format: Mach-O 32-bit i386
259MULTISECTIONS-ARCHIVE: Arch: i386
260MULTISECTIONS-ARCHIVE: AddressSize: 32bit
261MULTISECTIONS-ARCHIVE: Sections [
262MULTISECTIONS-ARCHIVE:   Section {
263MULTISECTIONS-ARCHIVE:     Index: 0
264MULTISECTIONS-ARCHIVE:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
265MULTISECTIONS-ARCHIVE:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
266MULTISECTIONS-ARCHIVE:     Address: 0x0
267MULTISECTIONS-ARCHIVE:     Size: 0x5
268MULTISECTIONS-ARCHIVE:     Offset: 324
269MULTISECTIONS-ARCHIVE:     Alignment: 4
270MULTISECTIONS-ARCHIVE:     RelocationOffset: 0x0
271MULTISECTIONS-ARCHIVE:     RelocationCount: 0
272MULTISECTIONS-ARCHIVE:     Type: 0x0
273MULTISECTIONS-ARCHIVE:     Attributes [ (0x800004)
274MULTISECTIONS-ARCHIVE:       PureInstructions (0x800000)
275MULTISECTIONS-ARCHIVE:       SomeInstructions (0x4)
276MULTISECTIONS-ARCHIVE:     ]
277MULTISECTIONS-ARCHIVE:     Reserved1: 0x0
278MULTISECTIONS-ARCHIVE:     Reserved2: 0x0
279MULTISECTIONS-ARCHIVE:   }
280MULTISECTIONS-ARCHIVE:   Section {
281MULTISECTIONS-ARCHIVE:     Index: 1
282MULTISECTIONS-ARCHIVE:     Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)
283MULTISECTIONS-ARCHIVE:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
284MULTISECTIONS-ARCHIVE:     Address: 0x8
285MULTISECTIONS-ARCHIVE:     Size: 0x4
286MULTISECTIONS-ARCHIVE:     Offset: 332
287MULTISECTIONS-ARCHIVE:     Alignment: 2
288MULTISECTIONS-ARCHIVE:     RelocationOffset: 0x0
289MULTISECTIONS-ARCHIVE:     RelocationCount: 0
290MULTISECTIONS-ARCHIVE:     Type: 0x0
291MULTISECTIONS-ARCHIVE:     Attributes [ (0x0)
292MULTISECTIONS-ARCHIVE:     ]
293MULTISECTIONS-ARCHIVE:     Reserved1: 0x0
294MULTISECTIONS-ARCHIVE:     Reserved2: 0x0
295MULTISECTIONS-ARCHIVE:   }
296MULTISECTIONS-ARCHIVE: ]
297
298