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