llvm.org GIT mirror llvm / a803ec4
[llvm-lipo] Implement -replace Replaces specified architecture in universal binary input file with slice from the file_name argument passed into the replace command. Differential Revision: https://reviews.llvm.org/D65247 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367248 91177308-0d34-0410-b5e6-96231b3b80d8 Anusha Basana 1 year, 17 days ago
7 changed file(s) with 1683 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 --- !mach-o
1 FileHeader:
2 magic: 0xFEEDFACE
3 cputype: 0x0000000C
4 cpusubtype: 0x00000009
5 filetype: 0x00000002
6 ncmds: 27
7 sizeofcmds: 2176
8 flags: 0x00200085
9 LoadCommands:
10 - cmd: LC_SEGMENT
11 cmdsize: 56
12 segname: __PAGEZERO
13 vmaddr: 0
14 vmsize: 16384
15 fileoff: 0
16 filesize: 0
17 maxprot: 0
18 initprot: 0
19 nsects: 0
20 flags: 0
21 - cmd: LC_SEGMENT
22 cmdsize: 260
23 segname: __TEXT
24 vmaddr: 16384
25 vmsize: 32768
26 fileoff: 0
27 filesize: 32768
28 maxprot: 5
29 initprot: 5
30 nsects: 3
31 flags: 0
32 Sections:
33 - sectname: __text
34 segname: __TEXT
35 addr: 0x000000000000BBA0
36 size: 804
37 offset: 0x00007BA0
38 align: 2
39 reloff: 0x00000000
40 nreloc: 0
41 flags: 0x80000400
42 reserved1: 0x00000000
43 reserved2: 0x00000000
44 reserved3: 0x00000000
45 - sectname: __picsymbolstub4
46 segname: __TEXT
47 addr: 0x000000000000BEC4
48 size: 160
49 offset: 0x00007EC4
50 align: 2
51 reloff: 0x00000000
52 nreloc: 0
53 flags: 0x80000408
54 reserved1: 0x00000000
55 reserved2: 0x00000010
56 reserved3: 0x00000000
57 - sectname: __stub_helper
58 segname: __TEXT
59 addr: 0x000000000000BF64
60 size: 156
61 offset: 0x00007F64
62 align: 2
63 reloff: 0x00000000
64 nreloc: 0
65 flags: 0x80000400
66 reserved1: 0x00000000
67 reserved2: 0x00000000
68 reserved3: 0x00000000
69 - cmd: LC_SEGMENT
70 cmdsize: 600
71 segname: __DATA
72 vmaddr: 49152
73 vmsize: 16384
74 fileoff: 32768
75 filesize: 16384
76 maxprot: 3
77 initprot: 3
78 nsects: 8
79 flags: 0
80 Sections:
81 - sectname: __nl_symbol_ptr
82 segname: __DATA
83 addr: 0x000000000000C000
84 size: 12
85 offset: 0x00008000
86 align: 2
87 reloff: 0x00000000
88 nreloc: 0
89 flags: 0x00000006
90 reserved1: 0x0000000A
91 reserved2: 0x00000000
92 reserved3: 0x00000000
93 - sectname: __la_symbol_ptr
94 segname: __DATA
95 addr: 0x000000000000C00C
96 size: 40
97 offset: 0x0000800C
98 align: 2
99 reloff: 0x00000000
100 nreloc: 0
101 flags: 0x00000007
102 reserved1: 0x0000000D
103 reserved2: 0x00000000
104 reserved3: 0x00000000
105 - sectname: __mod_init_func
106 segname: __DATA
107 addr: 0x000000000000C034
108 size: 4
109 offset: 0x00008034
110 align: 2
111 reloff: 0x00000000
112 nreloc: 0
113 flags: 0x00000009
114 reserved1: 0x00000000
115 reserved2: 0x00000000
116 reserved3: 0x00000000
117 - sectname: __const
118 segname: __DATA
119 addr: 0x000000000000C038
120 size: 36
121 offset: 0x00008038
122 align: 2
123 reloff: 0x00000000
124 nreloc: 0
125 flags: 0x00000000
126 reserved1: 0x00000000
127 reserved2: 0x00000000
128 reserved3: 0x00000000
129 - sectname: __cfstring
130 segname: __DATA
131 addr: 0x000000000000C05C
132 size: 160
133 offset: 0x0000805C
134 align: 2
135 reloff: 0x00000000
136 nreloc: 0
137 flags: 0x00000000
138 reserved1: 0x00000000
139 reserved2: 0x00000000
140 reserved3: 0x00000000
141 - sectname: __objc_imageinfo
142 segname: __DATA
143 addr: 0x000000000000C0FC
144 size: 8
145 offset: 0x000080FC
146 align: 2
147 reloff: 0x00000000
148 nreloc: 0
149 flags: 0x00000000
150 reserved1: 0x00000000
151 reserved2: 0x00000000
152 reserved3: 0x00000000
153 - sectname: __objc_selrefs
154 segname: __DATA
155 addr: 0x000000000000C104
156 size: 44
157 offset: 0x00008104
158 align: 2
159 reloff: 0x00000000
160 nreloc: 0
161 flags: 0x10000005
162 reserved1: 0x00000000
163 reserved2: 0x00000000
164 reserved3: 0x00000000
165 - sectname: __objc_classrefs
166 segname: __DATA
167 addr: 0x000000000000C130
168 size: 20
169 offset: 0x00008130
170 align: 2
171 reloff: 0x00000000
172 nreloc: 0
173 flags: 0x10000000
174 reserved1: 0x00000000
175 reserved2: 0x00000000
176 reserved3: 0x00000000
177 - cmd: LC_SEGMENT
178 cmdsize: 192
179 segname: __RODATA
180 vmaddr: 65536
181 vmsize: 16384
182 fileoff: 49152
183 filesize: 16384
184 maxprot: 1
185 initprot: 1
186 nsects: 2
187 flags: 0
188 Sections:
189 - sectname: __cstring
190 segname: __RODATA
191 addr: 0x0000000000010000
192 size: 191
193 offset: 0x0000C000
194 align: 0
195 reloff: 0x00000000
196 nreloc: 0
197 flags: 0x00000002
198 reserved1: 0x00000000
199 reserved2: 0x00000000
200 reserved3: 0x00000000
201 - sectname: __objc_methname
202 segname: __RODATA
203 addr: 0x00000000000100BF
204 size: 243
205 offset: 0x0000C0BF
206 align: 0
207 reloff: 0x00000000
208 nreloc: 0
209 flags: 0x00000002
210 reserved1: 0x00000000
211 reserved2: 0x00000000
212 reserved3: 0x00000000
213 - cmd: LC_SEGMENT
214 cmdsize: 56
215 segname: __LINKEDIT
216 vmaddr: 81920
217 vmsize: 32768
218 fileoff: 65536
219 filesize: 22592
220 maxprot: 1
221 initprot: 1
222 nsects: 0
223 flags: 0
224 - cmd: LC_DYLD_INFO_ONLY
225 cmdsize: 48
226 rebase_off: 65536
227 rebase_size: 16
228 bind_off: 65552
229 bind_size: 316
230 weak_bind_off: 0
231 weak_bind_size: 0
232 lazy_bind_off: 65868
233 lazy_bind_size: 260
234 export_off: 66128
235 export_size: 60
236 - cmd: LC_SYMTAB
237 cmdsize: 24
238 symoff: 66220
239 nsyms: 29
240 stroff: 66660
241 strsize: 708
242 - cmd: LC_DYSYMTAB
243 cmdsize: 80
244 ilocalsym: 0
245 nlocalsym: 7
246 iextdefsym: 7
247 nextdefsym: 3
248 iundefsym: 10
249 nundefsym: 19
250 tocoff: 0
251 ntoc: 0
252 modtaboff: 0
253 nmodtab: 0
254 extrefsymoff: 0
255 nextrefsyms: 0
256 indirectsymoff: 66568
257 nindirectsyms: 23
258 extreloff: 0
259 nextrel: 0
260 locreloff: 0
261 nlocrel: 0
262 - cmd: LC_LOAD_DYLINKER
263 cmdsize: 28
264 name: 12
265 PayloadString: '/usr/lib/dyld'
266 ZeroPadBytes: 3
267 - cmd: LC_UUID
268 cmdsize: 24
269 uuid: D36E4B66-CF78-37EC-B274-9DDADEECE4C1
270 - cmd: LC_VERSION_MIN_IPHONEOS
271 cmdsize: 16
272 version: 589824
273 sdk: 786944
274 - cmd: LC_SOURCE_VERSION
275 cmdsize: 16
276 version: 0
277 - cmd: LC_MAIN
278 cmdsize: 24
279 entryoff: 31913
280 stacksize: 0
281 - cmd: LC_ENCRYPTION_INFO
282 cmdsize: 20
283 cryptoff: 16384
284 cryptsize: 16384
285 cryptid: 0
286 - cmd: LC_LOAD_DYLIB
287 cmdsize: 48
288 dylib:
289 name: 24
290 timestamp: 2
291 current_version: 26216708
292 compatibility_version: 65536
293 PayloadString: '/usr/lib/libc++.1.dylib'
294 ZeroPadBytes: 1
295 - cmd: LC_LOAD_DYLIB
296 cmdsize: 68
297 dylib:
298 name: 24
299 timestamp: 2
300 current_version: 0
301 compatibility_version: 0
302 PayloadString: '@rpath/MobileConfig.framework/MobileConfig'
303 ZeroPadBytes: 2
304 - cmd: LC_LOAD_DYLIB
305 cmdsize: 84
306 dylib:
307 name: 24
308 timestamp: 2
309 current_version: 102895360
310 compatibility_version: 19660800
311 PayloadString: '/System/Library/Frameworks/Foundation.framework/Foundation'
312 ZeroPadBytes: 2
313 - cmd: LC_LOAD_DYLIB
314 cmdsize: 76
315 dylib:
316 name: 24
317 timestamp: 2
318 current_version: 917504
319 compatibility_version: 65536
320 PayloadString: '/System/Library/Frameworks/MapKit.framework/MapKit'
321 ZeroPadBytes: 2
322 - cmd: LC_LOAD_DYLIB
323 cmdsize: 84
324 dylib:
325 name: 24
326 timestamp: 2
327 current_version: 68352
328 compatibility_version: 66048
329 PayloadString: '/System/Library/Frameworks/QuartzCore.framework/QuartzCore'
330 ZeroPadBytes: 2
331 - cmd: LC_LOAD_DYLIB
332 cmdsize: 76
333 dylib:
334 name: 24
335 timestamp: 2
336 current_version: 3997696000
337 compatibility_version: 65536
338 PayloadString: '/System/Library/Frameworks/UIKit.framework/UIKit'
339 ZeroPadBytes: 4
340 - cmd: LC_LOAD_DYLIB
341 cmdsize: 52
342 dylib:
343 name: 24
344 timestamp: 2
345 current_version: 14942208
346 compatibility_version: 65536
347 PayloadString: '/usr/lib/libobjc.A.dylib'
348 ZeroPadBytes: 4
349 - cmd: LC_LOAD_DYLIB
350 cmdsize: 52
351 dylib:
352 name: 24
353 timestamp: 2
354 current_version: 82115073
355 compatibility_version: 65536
356 PayloadString: '/usr/lib/libSystem.B.dylib'
357 ZeroPadBytes: 2
358 - cmd: LC_LOAD_DYLIB
359 cmdsize: 92
360 dylib:
361 name: 24
362 timestamp: 2
363 current_version: 102895360
364 compatibility_version: 9830400
365 PayloadString: '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation'
366 ZeroPadBytes: 2
367 - cmd: LC_RPATH
368 cmdsize: 28
369 path: 12
370 PayloadString: '/usr/lib/swift'
371 ZeroPadBytes: 2
372 - cmd: LC_RPATH
373 cmdsize: 40
374 path: 12
375 PayloadString: '@executable_path/Frameworks'
376 ZeroPadBytes: 1
377 - cmd: LC_DATA_IN_CODE
378 cmdsize: 16
379 dataoff: 66188
380 datasize: 32
381 - cmd: LC_CODE_SIGNATURE
382 cmdsize: 16
383 dataoff: 67376
384 datasize: 20752
385 LinkEditData:
386 RebaseOpcodes:
387 - Opcode: REBASE_OPCODE_SET_TYPE_IMM
388 Imm: 1
389 - Opcode: REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
390 Imm: 2
391 ExtraData:
392 - 0x000000000000000C
393 - Opcode: REBASE_OPCODE_DO_REBASE_IMM_TIMES
394 Imm: 11
395 - Opcode: REBASE_OPCODE_ADD_ADDR_IMM_SCALED
396 Imm: 2
397 - Opcode: REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB
398 Imm: 0
399 ExtraData:
400 - 0x0000000000000010
401 - Opcode: REBASE_OPCODE_DO_REBASE_IMM_TIMES
402 Imm: 2
403 - Opcode: REBASE_OPCODE_ADD_ADDR_IMM_SCALED
404 Imm: 2
405 - Opcode: REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB
406 Imm: 0
407 ExtraData:
408 - 0x000000000000000A
409 - 0x000000000000000C
410 - Opcode: REBASE_OPCODE_DO_REBASE_IMM_TIMES
411 Imm: 11
412 - Opcode: REBASE_OPCODE_DONE
413 Imm: 0
414 BindOpcodes:
415 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
416 Imm: 3
417 Symbol: ''
418 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
419 Imm: 0
420 Symbol: '_OBJC_CLASS_$_NSBundle'
421 - Opcode: BIND_OPCODE_SET_TYPE_IMM
422 Imm: 1
423 Symbol: ''
424 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
425 Imm: 2
426 ULEBExtraData:
427 - 0x0000000000000140
428 Symbol: ''
429 - Opcode: BIND_OPCODE_DO_BIND
430 Imm: 0
431 Symbol: ''
432 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
433 Imm: 0
434 Symbol: '_OBJC_CLASS_$_NSJSONSerialization'
435 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB
436 Imm: 0
437 ULEBExtraData:
438 - 0xFFFFFFFFFFFFFFF0
439 Symbol: ''
440 - Opcode: BIND_OPCODE_DO_BIND
441 Imm: 0
442 Symbol: ''
443 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
444 Imm: 7
445 Symbol: ''
446 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
447 Imm: 0
448 Symbol: _objc_release
449 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB
450 Imm: 0
451 ULEBExtraData:
452 - 0xFFFFFFFFFFFFFED0
453 Symbol: ''
454 - Opcode: BIND_OPCODE_DO_BIND
455 Imm: 0
456 Symbol: ''
457 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
458 Imm: 8
459 Symbol: ''
460 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
461 Imm: 0
462 Symbol: __NSConcreteGlobalBlock
463 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB
464 Imm: 0
465 ULEBExtraData:
466 - 0x000000000000003C
467 Symbol: ''
468 - Opcode: BIND_OPCODE_DO_BIND
469 Imm: 0
470 Symbol: ''
471 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
472 Imm: 0
473 Symbol: dyld_stub_binder
474 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB
475 Imm: 0
476 ULEBExtraData:
477 - 0xFFFFFFFFFFFFFFB4
478 Symbol: ''
479 - Opcode: BIND_OPCODE_DO_BIND
480 Imm: 0
481 Symbol: ''
482 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
483 Imm: 9
484 Symbol: ''
485 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
486 Imm: 0
487 Symbol: '_OBJC_CLASS_$_NSData'
488 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB
489 Imm: 0
490 ULEBExtraData:
491 - 0x000000000000012C
492 Symbol: ''
493 - Opcode: BIND_OPCODE_DO_BIND
494 Imm: 0
495 Symbol: ''
496 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
497 Imm: 0
498 Symbol: '_OBJC_CLASS_$_NSMutableArray'
499 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB
500 Imm: 0
501 ULEBExtraData:
502 - 0x0000000000000008
503 Symbol: ''
504 - Opcode: BIND_OPCODE_DO_BIND
505 Imm: 0
506 Symbol: ''
507 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
508 Imm: 0
509 Symbol: '_OBJC_CLASS_$_NSUserDefaults'
510 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB
511 Imm: 0
512 ULEBExtraData:
513 - 0xFFFFFFFFFFFFFFF8
514 Symbol: ''
515 - Opcode: BIND_OPCODE_DO_BIND
516 Imm: 0
517 Symbol: ''
518 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
519 Imm: 0
520 Symbol: ___CFConstantStringClassReference
521 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB
522 Imm: 0
523 ULEBExtraData:
524 - 0xFFFFFFFFFFFFFF20
525 Symbol: ''
526 - Opcode: BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB
527 Imm: 0
528 ULEBExtraData:
529 - 0x0000000000000009
530 - 0x000000000000000C
531 Symbol: ''
532 - Opcode: BIND_OPCODE_DO_BIND
533 Imm: 0
534 Symbol: ''
535 LazyBindOpcodes:
536 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
537 Imm: 2
538 ULEBExtraData:
539 - 0x000000000000000C
540 Symbol: ''
541 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
542 Imm: 3
543 Symbol: ''
544 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
545 Imm: 0
546 Symbol: _NSClassFromString
547 - Opcode: BIND_OPCODE_DO_BIND
548 Imm: 0
549 Symbol: ''
550 - Opcode: BIND_OPCODE_DONE
551 Imm: 0
552 Symbol: ''
553 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
554 Imm: 2
555 ULEBExtraData:
556 - 0x0000000000000010
557 Symbol: ''
558 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
559 Imm: 6
560 Symbol: ''
561 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
562 Imm: 0
563 Symbol: _UIApplicationMain
564 - Opcode: BIND_OPCODE_DO_BIND
565 Imm: 0
566 Symbol: ''
567 - Opcode: BIND_OPCODE_DONE
568 Imm: 0
569 Symbol: ''
570 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
571 Imm: 2
572 ULEBExtraData:
573 - 0x0000000000000014
574 Symbol: ''
575 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
576 Imm: 7
577 Symbol: ''
578 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
579 Imm: 0
580 Symbol: _objc_autoreleasePoolPop
581 - Opcode: BIND_OPCODE_DO_BIND
582 Imm: 0
583 Symbol: ''
584 - Opcode: BIND_OPCODE_DONE
585 Imm: 0
586 Symbol: ''
587 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
588 Imm: 2
589 ULEBExtraData:
590 - 0x0000000000000018
591 Symbol: ''
592 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
593 Imm: 7
594 Symbol: ''
595 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
596 Imm: 0
597 Symbol: _objc_autoreleasePoolPush
598 - Opcode: BIND_OPCODE_DO_BIND
599 Imm: 0
600 Symbol: ''
601 - Opcode: BIND_OPCODE_DONE
602 Imm: 0
603 Symbol: ''
604 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
605 Imm: 2
606 ULEBExtraData:
607 - 0x000000000000001C
608 Symbol: ''
609 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
610 Imm: 7
611 Symbol: ''
612 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
613 Imm: 0
614 Symbol: _objc_autoreleaseReturnValue
615 - Opcode: BIND_OPCODE_DO_BIND
616 Imm: 0
617 Symbol: ''
618 - Opcode: BIND_OPCODE_DONE
619 Imm: 0
620 Symbol: ''
621 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
622 Imm: 2
623 ULEBExtraData:
624 - 0x0000000000000020
625 Symbol: ''
626 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
627 Imm: 7
628 Symbol: ''
629 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
630 Imm: 0
631 Symbol: _objc_msgSend
632 - Opcode: BIND_OPCODE_DO_BIND
633 Imm: 0
634 Symbol: ''
635 - Opcode: BIND_OPCODE_DONE
636 Imm: 0
637 Symbol: ''
638 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
639 Imm: 2
640 ULEBExtraData:
641 - 0x0000000000000024
642 Symbol: ''
643 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
644 Imm: 7
645 Symbol: ''
646 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
647 Imm: 0
648 Symbol: _objc_release
649 - Opcode: BIND_OPCODE_DO_BIND
650 Imm: 0
651 Symbol: ''
652 - Opcode: BIND_OPCODE_DONE
653 Imm: 0
654 Symbol: ''
655 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
656 Imm: 2
657 ULEBExtraData:
658 - 0x0000000000000028
659 Symbol: ''
660 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
661 Imm: 7
662 Symbol: ''
663 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
664 Imm: 0
665 Symbol: _objc_retainAutoreleasedReturnValue
666 - Opcode: BIND_OPCODE_DO_BIND
667 Imm: 0
668 Symbol: ''
669 - Opcode: BIND_OPCODE_DONE
670 Imm: 0
671 Symbol: ''
672 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
673 Imm: 2
674 ULEBExtraData:
675 - 0x000000000000002C
676 Symbol: ''
677 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
678 Imm: 8
679 Symbol: ''
680 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
681 Imm: 0
682 Symbol: _strcmp
683 - Opcode: BIND_OPCODE_DO_BIND
684 Imm: 0
685 Symbol: ''
686 - Opcode: BIND_OPCODE_DONE
687 Imm: 0
688 Symbol: ''
689 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
690 Imm: 2
691 ULEBExtraData:
692 - 0x0000000000000030
693 Symbol: ''
694 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
695 Imm: 8
696 Symbol: ''
697 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
698 Imm: 0
699 Symbol: _strlen
700 - Opcode: BIND_OPCODE_DO_BIND
701 Imm: 0
702 Symbol: ''
703 - Opcode: BIND_OPCODE_DONE
704 Imm: 0
705 Symbol: ''
706 - Opcode: BIND_OPCODE_DONE
707 Imm: 0
708 Symbol: ''
709 - Opcode: BIND_OPCODE_DONE
710 Imm: 0
711 Symbol: ''
712 ExportTrie:
713 TerminalSize: 0
714 NodeOffset: 0
715 Name: ''
716 Flags: 0x0000000000000000
717 Address: 0x0000000000000000
718 Other: 0x0000000000000000
719 ImportName: ''
720 Children:
721 - TerminalSize: 0
722 NodeOffset: 5
723 Name: _
724 Flags: 0x0000000000000000
725 Address: 0x0000000000000000
726 Other: 0x0000000000000000
727 ImportName: ''
728 Children:
729 - TerminalSize: 2
730 NodeOffset: 41
731 Name: _mh_execute_header
732 Flags: 0x0000000000000000
733 Address: 0x0000000000000000
734 Other: 0x0000000000000000
735 ImportName: ''
736 - TerminalSize: 4
737 NodeOffset: 45
738 Name: main
739 Flags: 0x0000000000000000
740 Address: 0x0000000000007CA9
741 Other: 0x0000000000000000
742 ImportName: ''
743 - TerminalSize: 4
744 NodeOffset: 51
745 Name: MNMain
746 Flags: 0x0000000000000000
747 Address: 0x0000000000007E45
748 Other: 0x0000000000000000
749 ImportName: ''
750 NameList:
751 - n_strx: 461
752 n_type: 0x0E
753 n_sect: 1
754 n_desc: 8
755 n_value: 48032
756 - n_strx: 487
757 n_type: 0x0E
758 n_sect: 1
759 n_desc: 8
760 n_value: 48776
761 - n_strx: 540
762 n_type: 0x1E
763 n_sect: 1
764 n_desc: 8
765 n_value: 48812
766 - n_strx: 559
767 n_type: 0x1E
768 n_sect: 1
769 n_desc: 8
770 n_value: 48824
771 - n_strx: 593
772 n_type: 0x1E
773 n_sect: 3
774 n_desc: 0
775 n_value: 48996
776 - n_strx: 607
777 n_type: 0x0E
778 n_sect: 7
779 n_desc: 0
780 n_value: 49208
781 - n_strx: 656
782 n_type: 0x0E
783 n_sect: 7
784 n_desc: 0
785 n_value: 49224
786 - n_strx: 4
787 n_type: 0x0F
788 n_sect: 1
789 n_desc: 8
790 n_value: 48708
791 - n_strx: 12
792 n_type: 0x0F
793 n_sect: 1
794 n_desc: 16
795 n_value: 16384
796 - n_strx: 32
797 n_type: 0x0F
798 n_sect: 1
799 n_desc: 8
800 n_value: 48296
801 - n_strx: 38
802 n_type: 0x01
803 n_sect: 0
804 n_desc: 768
805 n_value: 0
806 - n_strx: 57
807 n_type: 0x01
808 n_sect: 0
809 n_desc: 768
810 n_value: 0
811 - n_strx: 80
812 n_type: 0x01
813 n_sect: 0
814 n_desc: 2304
815 n_value: 0
816 - n_strx: 101
817 n_type: 0x01
818 n_sect: 0
819 n_desc: 768
820 n_value: 0
821 - n_strx: 135
822 n_type: 0x01
823 n_sect: 0
824 n_desc: 2304
825 n_value: 0
826 - n_strx: 164
827 n_type: 0x01
828 n_sect: 0
829 n_desc: 2304
830 n_value: 0
831 - n_strx: 193
832 n_type: 0x01
833 n_sect: 0
834 n_desc: 1536
835 n_value: 0
836 - n_strx: 212
837 n_type: 0x01
838 n_sect: 0
839 n_desc: 2048
840 n_value: 0
841 - n_strx: 236
842 n_type: 0x01
843 n_sect: 0
844 n_desc: 2304
845 n_value: 0
846 - n_strx: 270
847 n_type: 0x01
848 n_sect: 0
849 n_desc: 2048
850 n_value: 0
851 - n_strx: 284
852 n_type: 0x01
853 n_sect: 0
854 n_desc: 1792
855 n_value: 0
856 - n_strx: 309
857 n_type: 0x01
858 n_sect: 0
859 n_desc: 1792
860 n_value: 0
861 - n_strx: 335
862 n_type: 0x01
863 n_sect: 0
864 n_desc: 1792
865 n_value: 0
866 - n_strx: 364
867 n_type: 0x01
868 n_sect: 0
869 n_desc: 1792
870 n_value: 0
871 - n_strx: 378
872 n_type: 0x01
873 n_sect: 0
874 n_desc: 1792
875 n_value: 0
876 - n_strx: 392
877 n_type: 0x01
878 n_sect: 0
879 n_desc: 1792
880 n_value: 0
881 - n_strx: 428
882 n_type: 0x01
883 n_sect: 0
884 n_desc: 2048
885 n_value: 0
886 - n_strx: 436
887 n_type: 0x01
888 n_sect: 0
889 n_desc: 2048
890 n_value: 0
891 - n_strx: 444
892 n_type: 0x01
893 n_sect: 0
894 n_desc: 2048
895 n_value: 0
896 StringTable:
897 - ''
898 - ''
899 - ''
900 - ''
901 - _MNMain
902 - __mh_execute_header
903 - _main
904 - _NSClassFromString
905 - '_OBJC_CLASS_$_NSBundle'
906 - '_OBJC_CLASS_$_NSData'
907 - '_OBJC_CLASS_$_NSJSONSerialization'
908 - '_OBJC_CLASS_$_NSMutableArray'
909 - '_OBJC_CLASS_$_NSUserDefaults'
910 - _UIApplicationMain
911 - __NSConcreteGlobalBlock
912 - ___CFConstantStringClassReference
913 - ___truncdfhf2
914 - _objc_autoreleasePoolPop
915 - _objc_autoreleasePoolPush
916 - _objc_autoreleaseReturnValue
917 - _objc_msgSend
918 - _objc_release
919 - _objc_retainAutoreleasedReturnValue
920 - _strcmp
921 - _strlen
922 - dyld_stub_binder
923 - _FBParseCommandLineParams
924 - ___MNMain_block_invoke_7636.llvm.6232502296855065941
925 - '_objc_release$shim'
926 - '_objc_autoreleaseReturnValue$shim'
927 - ' stub helpers'
928 - ___block_descriptor_tmp.llvm.6232502296855065941
929 - ___block_literal_global.llvm.6232502296855065941
930 - ''
931 - ''
932 - ''
933 ...
0 --- !fat-mach-o
1 FatHeader:
2 magic: 0xCAFEBABE
3 nfat_arch: 2
4 FatArchs:
5 - cputype: 0x0000000C
6 cpusubtype: 0x00000009
7 offset: 0x0000000000000030
8 size: 432
9 align: 4
10 - cputype: 0x00000007
11 cpusubtype: 0x00000003
12 offset: 0x0000000000001000
13 size: 432
14 align: 12
15 Slices:
16 - !mach-o
17 FileHeader:
18 magic: 0xFEEDFACE
19 cputype: 0x0000000C
20 cpusubtype: 0x00000009
21 filetype: 0x00000001
22 ncmds: 4
23 sizeofcmds: 312
24 flags: 0x00002000
25 LoadCommands:
26 - cmd: LC_SEGMENT
27 cmdsize: 192
28 segname: ''
29 vmaddr: 0
30 vmsize: 72
31 fileoff: 340
32 filesize: 72
33 maxprot: 7
34 initprot: 7
35 nsects: 2
36 flags: 0
37 Sections:
38 - sectname: __text
39 segname: __TEXT
40 addr: 0x0000000000000000
41 size: 18
42 offset: 0x00000154
43 align: 4
44 reloff: 0x00000000
45 nreloc: 0
46 flags: 0x80000400
47 reserved1: 0x00000000
48 reserved2: 0x00000000
49 reserved3: 0x00000000
50 - sectname: __eh_frame
51 segname: __TEXT
52 addr: 0x0000000000000014
53 size: 52
54 offset: 0x00000168
55 align: 2
56 reloff: 0x00000000
57 nreloc: 0
58 flags: 0x6800000B
59 reserved1: 0x00000000
60 reserved2: 0x00000000
61 reserved3: 0x00000000
62 - cmd: LC_VERSION_MIN_MACOSX
63 cmdsize: 16
64 version: 656384
65 sdk: 0
66 - cmd: LC_SYMTAB
67 cmdsize: 24
68 symoff: 412
69 nsyms: 1
70 stroff: 424
71 strsize: 8
72 - cmd: LC_DYSYMTAB
73 cmdsize: 80
74 ilocalsym: 0
75 nlocalsym: 0
76 iextdefsym: 0
77 nextdefsym: 1
78 iundefsym: 1
79 nundefsym: 0
80 tocoff: 0
81 ntoc: 0
82 modtaboff: 0
83 nmodtab: 0
84 extrefsymoff: 0
85 nextrefsyms: 0
86 indirectsymoff: 0
87 nindirectsyms: 0
88 extreloff: 0
89 nextrel: 0
90 locreloff: 0
91 nlocrel: 0
92 LinkEditData:
93 NameList:
94 - n_strx: 1
95 n_type: 0x0F
96 n_sect: 1
97 n_desc: 0
98 n_value: 0
99 StringTable:
100 - ''
101 - _main
102 - ''
103 - !mach-o
104 FileHeader:
105 magic: 0xFEEDFACE
106 cputype: 0x00000007
107 cpusubtype: 0x00000003
108 filetype: 0x00000001
109 ncmds: 4
110 sizeofcmds: 312
111 flags: 0x00002000
112 LoadCommands:
113 - cmd: LC_SEGMENT
114 cmdsize: 192
115 segname: ''
116 vmaddr: 0
117 vmsize: 72
118 fileoff: 340
119 filesize: 72
120 maxprot: 7
121 initprot: 7
122 nsects: 2
123 flags: 0
124 Sections:
125 - sectname: __text
126 segname: __TEXT
127 addr: 0x0000000000000000
128 size: 18
129 offset: 0x00000154
130 align: 4
131 reloff: 0x00000000
132 nreloc: 0
133 flags: 0x80000400
134 reserved1: 0x00000000
135 reserved2: 0x00000000
136 reserved3: 0x00000000
137 - sectname: __eh_frame
138 segname: __TEXT
139 addr: 0x0000000000000014
140 size: 52
141 offset: 0x00000168
142 align: 2
143 reloff: 0x00000000
144 nreloc: 0
145 flags: 0x6800000B
146 reserved1: 0x00000000
147 reserved2: 0x00000000
148 reserved3: 0x00000000
149 - cmd: LC_VERSION_MIN_MACOSX
150 cmdsize: 16
151 version: 656384
152 sdk: 0
153 - cmd: LC_SYMTAB
154 cmdsize: 24
155 symoff: 412
156 nsyms: 1
157 stroff: 424
158 strsize: 8
159 - cmd: LC_DYSYMTAB
160 cmdsize: 80
161 ilocalsym: 0
162 nlocalsym: 0
163 iextdefsym: 0
164 nextdefsym: 1
165 iundefsym: 1
166 nundefsym: 0
167 tocoff: 0
168 ntoc: 0
169 modtaboff: 0
170 nmodtab: 0
171 extrefsymoff: 0
172 nextrefsyms: 0
173 indirectsymoff: 0
174 nindirectsyms: 0
175 extreloff: 0
176 nextrel: 0
177 locreloff: 0
178 nlocrel: 0
179 LinkEditData:
180 NameList:
181 - n_strx: 1
182 n_type: 0x0F
183 n_sect: 1
184 n_desc: 0
185 n_value: 0
186 StringTable:
187 - ''
188 - _main
189 - ''
190 ...
0 --- !fat-mach-o
1 FatHeader:
2 magic: 0xCAFEBABE
3 nfat_arch: 4
4 FatArchs:
5 - cputype: 0x00000007
6 cpusubtype: 0x00000003
7 offset: 0x0000000000001000
8 size: 432
9 align: 12
10 - cputype: 0x01000007
11 cpusubtype: 0x00000003
12 offset: 0x0000000000002000
13 size: 488
14 align: 12
15 - cputype: 0x0000000C
16 cpusubtype: 0x00000009
17 offset: 0x0000000000004000
18 size: 304
19 align: 14
20 - cputype: 0x0100000C
21 cpusubtype: 0x00000000
22 offset: 0x0000000000008000
23 size: 516
24 align: 14
25 Slices:
26 - !mach-o
27 FileHeader:
28 magic: 0xFEEDFACE
29 cputype: 0x00000007
30 cpusubtype: 0x00000003
31 filetype: 0x00000001
32 ncmds: 4
33 sizeofcmds: 312
34 flags: 0x00002000
35 LoadCommands:
36 - cmd: LC_SEGMENT
37 cmdsize: 192
38 segname: ''
39 vmaddr: 0
40 vmsize: 72
41 fileoff: 340
42 filesize: 72
43 maxprot: 7
44 initprot: 7
45 nsects: 2
46 flags: 0
47 Sections:
48 - sectname: __text
49 segname: __TEXT
50 addr: 0x0000000000000000
51 size: 18
52 offset: 0x00000154
53 align: 4
54 reloff: 0x00000000
55 nreloc: 0
56 flags: 0x80000400
57 reserved1: 0x00000000
58 reserved2: 0x00000000
59 reserved3: 0x00000000
60 - sectname: __eh_frame
61 segname: __TEXT
62 addr: 0x0000000000000014
63 size: 52
64 offset: 0x00000168
65 align: 2
66 reloff: 0x00000000
67 nreloc: 0
68 flags: 0x6800000B
69 reserved1: 0x00000000
70 reserved2: 0x00000000
71 reserved3: 0x00000000
72 - cmd: LC_VERSION_MIN_MACOSX
73 cmdsize: 16
74 version: 656384
75 sdk: 0
76 - cmd: LC_SYMTAB
77 cmdsize: 24
78 symoff: 412
79 nsyms: 1
80 stroff: 424
81 strsize: 8
82 - cmd: LC_DYSYMTAB
83 cmdsize: 80
84 ilocalsym: 0
85 nlocalsym: 0
86 iextdefsym: 0
87 nextdefsym: 1
88 iundefsym: 1
89 nundefsym: 0
90 tocoff: 0
91 ntoc: 0
92 modtaboff: 0
93 nmodtab: 0
94 extrefsymoff: 0
95 nextrefsyms: 0
96 indirectsymoff: 0
97 nindirectsyms: 0
98 extreloff: 0
99 nextrel: 0
100 locreloff: 0
101 nlocrel: 0
102 LinkEditData:
103 NameList:
104 - n_strx: 1
105 n_type: 0x0F
106 n_sect: 1
107 n_desc: 0
108 n_value: 0
109 StringTable:
110 - ''
111 - _main
112 - ''
113 - !mach-o
114 FileHeader:
115 magic: 0xFEEDFACF
116 cputype: 0x01000007
117 cpusubtype: 0x00000003
118 filetype: 0x00000001
119 ncmds: 4
120 sizeofcmds: 352
121 flags: 0x00002000
122 reserved: 0x00000000
123 LoadCommands:
124 - cmd: LC_SEGMENT_64
125 cmdsize: 232
126 segname: ''
127 vmaddr: 0
128 vmsize: 80
129 fileoff: 384
130 filesize: 80
131 maxprot: 7
132 initprot: 7
133 nsects: 2
134 flags: 0
135 Sections:
136 - sectname: __text
137 segname: __TEXT
138 addr: 0x0000000000000000
139 size: 15
140 offset: 0x00000180
141 align: 4
142 reloff: 0x00000000
143 nreloc: 0
144 flags: 0x80000400
145 reserved1: 0x00000000
146 reserved2: 0x00000000
147 reserved3: 0x00000000
148 - sectname: __eh_frame
149 segname: __TEXT
150 addr: 0x0000000000000010
151 size: 64
152 offset: 0x00000190
153 align: 3
154 reloff: 0x00000000
155 nreloc: 0
156 flags: 0x6800000B
157 reserved1: 0x00000000
158 reserved2: 0x00000000
159 reserved3: 0x00000000
160 - cmd: LC_VERSION_MIN_MACOSX
161 cmdsize: 16
162 version: 656384
163 sdk: 0
164 - cmd: LC_SYMTAB
165 cmdsize: 24
166 symoff: 464
167 nsyms: 1
168 stroff: 480
169 strsize: 8
170 - cmd: LC_DYSYMTAB
171 cmdsize: 80
172 ilocalsym: 0
173 nlocalsym: 0
174 iextdefsym: 0
175 nextdefsym: 1
176 iundefsym: 1
177 nundefsym: 0
178 tocoff: 0
179 ntoc: 0
180 modtaboff: 0
181 nmodtab: 0
182 extrefsymoff: 0
183 nextrefsyms: 0
184 indirectsymoff: 0
185 nindirectsyms: 0
186 extreloff: 0
187 nextrel: 0
188 locreloff: 0
189 nlocrel: 0
190 LinkEditData:
191 NameList:
192 - n_strx: 1
193 n_type: 0x0F
194 n_sect: 1
195 n_desc: 0
196 n_value: 0
197 StringTable:
198 - ''
199 - _main
200 - ''
201 - !mach-o
202 FileHeader:
203 magic: 0xFEEDFACE
204 cputype: 0x0000000C
205 cpusubtype: 0x00000009
206 filetype: 0x00000001
207 ncmds: 4
208 sizeofcmds: 244
209 flags: 0x00002000
210 LoadCommands:
211 - cmd: LC_SEGMENT
212 cmdsize: 124
213 segname: ''
214 vmaddr: 0
215 vmsize: 10
216 fileoff: 272
217 filesize: 10
218 maxprot: 7
219 initprot: 7
220 nsects: 1
221 flags: 0
222 Sections:
223 - sectname: __text
224 segname: __TEXT
225 addr: 0x0000000000000000
226 size: 10
227 offset: 0x00000110
228 align: 1
229 reloff: 0x00000000
230 nreloc: 0
231 flags: 0x80000400
232 reserved1: 0x00000000
233 reserved2: 0x00000000
234 reserved3: 0x00000000
235 - cmd: LC_VERSION_MIN_IPHONEOS
236 cmdsize: 16
237 version: 327680
238 sdk: 0
239 - cmd: LC_SYMTAB
240 cmdsize: 24
241 symoff: 284
242 nsyms: 1
243 stroff: 296
244 strsize: 8
245 - cmd: LC_DYSYMTAB
246 cmdsize: 80
247 ilocalsym: 0
248 nlocalsym: 0
249 iextdefsym: 0
250 nextdefsym: 1
251 iundefsym: 1
252 nundefsym: 0
253 tocoff: 0
254 ntoc: 0
255 modtaboff: 0
256 nmodtab: 0
257 extrefsymoff: 0
258 nextrefsyms: 0
259 indirectsymoff: 0
260 nindirectsyms: 0
261 extreloff: 0
262 nextrel: 0
263 locreloff: 0
264 nlocrel: 0
265 LinkEditData:
266 NameList:
267 - n_strx: 1
268 n_type: 0x0F
269 n_sect: 1
270 n_desc: 8
271 n_value: 0
272 StringTable:
273 - ''
274 - _main
275 - ''
276 - !mach-o
277 FileHeader:
278 magic: 0xFEEDFACF
279 cputype: 0x0100000C
280 cpusubtype: 0x00000000
281 filetype: 0x00000001
282 ncmds: 4
283 sizeofcmds: 352
284 flags: 0x00002000
285 reserved: 0x00000000
286 LoadCommands:
287 - cmd: LC_SEGMENT_64
288 cmdsize: 232
289 segname: ''
290 vmaddr: 0
291 vmsize: 56
292 fileoff: 384
293 filesize: 56
294 maxprot: 7
295 initprot: 7
296 nsects: 2
297 flags: 0
298 Sections:
299 - sectname: __text
300 segname: __TEXT
301 addr: 0x0000000000000000
302 size: 20
303 offset: 0x00000180
304 align: 2
305 reloff: 0x00000000
306 nreloc: 0
307 flags: 0x80000400
308 reserved1: 0x00000000
309 reserved2: 0x00000000
310 reserved3: 0x00000000
311 - sectname: __compact_unwind
312 segname: __LD
313 addr: 0x0000000000000018
314 size: 32
315 offset: 0x00000198
316 align: 3
317 reloff: 0x000001B8
318 nreloc: 1
319 flags: 0x02000000
320 reserved1: 0x00000000
321 reserved2: 0x00000000
322 reserved3: 0x00000000
323 - cmd: LC_VERSION_MIN_IPHONEOS
324 cmdsize: 16
325 version: 327680
326 sdk: 0
327 - cmd: LC_SYMTAB
328 cmdsize: 24
329 symoff: 448
330 nsyms: 3
331 stroff: 496
332 strsize: 20
333 - cmd: LC_DYSYMTAB
334 cmdsize: 80
335 ilocalsym: 0
336 nlocalsym: 2
337 iextdefsym: 2
338 nextdefsym: 1
339 iundefsym: 3
340 nundefsym: 0
341 tocoff: 0
342 ntoc: 0
343 modtaboff: 0
344 nmodtab: 0
345 extrefsymoff: 0
346 nextrefsyms: 0
347 indirectsymoff: 0
348 nindirectsyms: 0
349 extreloff: 0
350 nextrel: 0
351 locreloff: 0
352 nlocrel: 0
353 LinkEditData:
354 NameList:
355 - n_strx: 13
356 n_type: 0x0E
357 n_sect: 1
358 n_desc: 0
359 n_value: 0
360 - n_strx: 7
361 n_type: 0x0E
362 n_sect: 2
363 n_desc: 0
364 n_value: 24
365 - n_strx: 1
366 n_type: 0x0F
367 n_sect: 1
368 n_desc: 0
369 n_value: 0
370 StringTable:
371 - ''
372 - _main
373 - ltmp1
374 - ltmp0
375 - ''
376 ...
0 # RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-32.o
1 # RUN: yaml2obj %p/Inputs/arm64-slice.yaml > %t-arm64.o
2 # RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o
3
4 # RUN: not llvm-lipo %t-universal.o -replace %t-32.o 2>&1 | FileCheck --check-prefix=MISSING_ARG %s
5 # MISSING_ARG: error: replace is missing an argument: expects -replace arch_type file_name
6
7 # RUN: not llvm-lipo %t-universal.o -replace %t-32.o i386 2>&1 | FileCheck --check-prefix=OUTPUT_FILE %s
8 # OUTPUT_FILE: error: replace expects a single output file to be specified
9
10 # RUN: not llvm-lipo %t-universal.o %t-universal.o -replace %t-32.o i386 -o %t.o 2>&1 | FileCheck --check-prefix=INPUT_ARGS %s
11 # INPUT_ARGS: error: replace expects a single input file
12
13 # RUN: not llvm-lipo %t-universal.o -replace %t-32.o i386 -o %t.o 2>&1 | FileCheck --check-prefix=INVALID_FILE %s
14 # INVALID_FILE: error: 'i386': No such file or directory
15
16 # RUN: not llvm-lipo %t-universal.o -replace i3866 %t-32.o -o %t.o 2>&1 | FileCheck --check-prefix=INVALID_ARCH %s
17 # INVALID_ARCH: error: Invalid architecture: i3866
18
19 # RUN: not llvm-lipo %t-universal.o -replace arm64 %t-32.o -o %t.o 2>&1 | FileCheck --check-prefix=ARCH_NOT_MATCHED %s
20 # ARCH_NOT_MATCHED: error: specified architecture: arm64 for replacement file: {{.*}} does not match the file's architecture
21
22 # RUN: not llvm-lipo %t-universal.o -replace arm64 %t-arm64.o -o %t.o 2>&1 | FileCheck --check-prefix=ARCH_NOT_IN_INPUT %s
23 # ARCH_NOT_IN_INPUT: error: -replace arm64 specified but fat file: {{.*}} does not contain that architecture
24
25 # RUN: not llvm-lipo %t-universal.o -replace i386 %t-32.o -replace arm64 %t-universal.o -o %t.o 2>&1 | FileCheck --check-prefix=REPLACE_UNIVERSAL %s
26 # REPLACE_UNIVERSAL: replacement file: {{.*}} is a fat file (must be a thin file)
27
28 # RUN: not llvm-lipo %t-universal.o -replace i386 %t-32.o -replace i386 %t-32.o -o %t.o 2>&1 | FileCheck --check-prefix=ARCH_DUPLICATE %s
29 # ARCH_DUPLICATE: error: -replace i386 specified multiple times:
0 # RUN: yaml2obj %p/Inputs/armv7-slice-big.yaml > %t-armv7big.o
1 # RUN: yaml2obj %p/Inputs/i386-x86_64-armv7-arm64-universal.yaml > %t-universal.o
2
3 # RUN: llvm-lipo %t-universal.o -replace armv7 %t-armv7big.o -o %t.o
4 # RUN: llvm-objdump %t.o -m --universal-headers | FileCheck --check-prefix=ARMV7_BIG %s
5 # RUN: llvm-lipo %t.o -thin armv7 -o %t-armv7-out.o
6 # RUN: cmp %t-armv7big.o %t-armv7-out.o
7 # ARMV7_BIG: architecture i386
8 # ARMV7_BIG: offset 4096
9 # ARMV7_BIG: align 2^12 (4096)
10 # ARMV7_BIG-NEXT: architecture x86_64
11 # ARMV7_BIG: offset 8192
12 # ARMV7_BIG: align 2^12 (4096)
13 # ARMV7_BIG-NEXT: architecture armv7
14 # ARMV7_BIG: offset 16384
15 # ARMV7_BIG: size 88128
16 # ARMV7_BIG: align 2^14 (16384)
17 # ARMV7_BIG-NEXT: architecture arm64
18 # ARMV7_BIG: offset 114688
19 # ARMV7_BIG: size 516
20 # ARMV7_BIG: align 2^14 (16384)
21
22 # RUN: yaml2obj %p/Inputs/armv7-slice.yaml > %t-armv7.o
23 # RUN: yaml2obj %p/Inputs/armv7_i386_non_default_alignment.yaml > %t-universal-align.o
24
25 # RUN: llvm-lipo %t-universal-align.o -replace armv7 %t-armv7.o -o %t2.o
26 # RUN: llvm-objdump %t2.o -m --universal-headers | FileCheck --check-prefix=ARMV7_ALIGN_SWAP %s
27 # RUN: llvm-lipo %t2.o -thin armv7 -o %t-armv7-out2.o
28 # RUN: cmp %t-armv7.o %t-armv7-out2.o
29 # ARMV7_ALIGN_SWAP: architecture i386
30 # ARMV7_ALIGN_SWAP: offset 4096
31 # ARMV7_ALIGN_SWAP: align 2^12 (4096)
32 # ARMV7_ALIGN_SWAP-NEXT: architecture armv7
33 # ARMV7_ALIGN_SWAP: offset 16384
34 # ARMV7_ALIGN_SWAP: align 2^14 (16384)
3333 HelpText<"Create a universal binary output file from the input "
3434 "files. Requires -output option">;
3535
36 def replace
37 : MultiArg<["-", "--"], "replace", 2>,
38 Group,
39 HelpText<"Replace the specified arch type with the contents of the "
40 "input_file in a universal binary. Requires -output option">;
41
3642 def output : Option<["-", "--"], "output", KIND_SEPARATE>,
3743 HelpText<"Create output file with specified name">;
3844 def o : JoinedOrSeparate<["-"], "o">, Alias;
8181 VerifyArch,
8282 ThinArch,
8383 CreateUniversal,
84 ReplaceArch,
85 };
86
87 struct Replacement {
88 StringRef ArchType;
89 StringRef FileName;
8490 };
8591
8692 struct Config {
8793 SmallVector InputFiles;
8894 SmallVector VerifyArchList;
95 SmallVector Replacements;
8996 std::string ThinArchType;
9097 std::string OutputFile;
9198 LipoAction ActionToPerform;
157164 SmallVector ActionArgs(InputArgs.filtered(LIPO_action_group));
158165 if (ActionArgs.empty())
159166 reportError("at least one action should be specified");
160 if (ActionArgs.size() > 1) {
167 // errors if multiple actions specified other than replace
168 // multiple replace flags may be specified, as long as they are not mixed with
169 // other action flags
170 auto ReplacementArgsRange = InputArgs.filtered(LIPO_replace);
171 if (ActionArgs.size() > 1 &&
172 ActionArgs.size() !=
173 static_cast(std::distance(ReplacementArgsRange.begin(),
174 ReplacementArgsRange.end()))) {
161175 std::string Buf;
162176 raw_string_ostream OS(Buf);
163177 OS << "only one of the following actions can be specified:";
203217 if (C.OutputFile.empty())
204218 reportError("create expects a single output file to be specified");
205219 C.ActionToPerform = LipoAction::CreateUniversal;
220 return C;
221
222 case LIPO_replace:
223 for (auto Action : ActionArgs) {
224 if (!Action->getValue(1))
225 reportError(
226 "replace is missing an argument: expects -replace arch_type "
227 "file_name");
228 C.Replacements.push_back(
229 Replacement{Action->getValue(0), Action->getValue(1)});
230 }
231
232 if (C.OutputFile.empty())
233 reportError("replace expects a single output file to be specified");
234 if (C.InputFiles.size() > 1)
235 reportError("replace expects a single input file");
236 C.ActionToPerform = LipoAction::ReplaceArch;
206237 return C;
207238
208239 default:
556587 exit(EXIT_SUCCESS);
557588 }
558589
590 static StringMap
591 buildReplacementSlices(ArrayRef> ReplacementBinaries,
592 ArrayRef Replacements) {
593 assert(ReplacementBinaries.size() == Replacements.size() &&
594 "Number of replacment binaries does not match the number of "
595 "replacements");
596 StringMap Slices;
597 // populates StringMap of slices to replace with; error checks for mismatched
598 // replace flag args, fat files, and duplicate arch_types
599 for (size_t Index = 0, Size = Replacements.size(); Index < Size; ++Index) {
600 StringRef ReplacementArch = Replacements[Index].ArchType;
601 const Binary *ReplacementBinary = ReplacementBinaries[Index].getBinary();
602 validateArchitectureName(ReplacementArch);
603
604 auto O = dyn_cast(ReplacementBinary);
605 if (!O)
606 reportError("replacement file: " + ReplacementBinary->getFileName() +
607 " is a fat file (must be a thin file)");
608
609 if (O->getArch() != Triple(ReplacementArch).getArch())
610 reportError("specified architecture: " + ReplacementArch +
611 " for replacement file: " + ReplacementBinary->getFileName() +
612 " does not match the file's architecture");
613
614 auto Entry =
615 Slices.try_emplace(ReplacementArch, Slice{O, calculateAlignment(O)});
616 if (!Entry.second)
617 reportError("-replace " + ReplacementArch +
618 " specified multiple times: " +
619 Entry.first->second.ObjectFile->getFileName() + ", " +
620 O->getFileName());
621 }
622 return Slices;
623 }
624
625 LLVM_ATTRIBUTE_NORETURN
626 static void replaceSlices(ArrayRef> InputBinaries,
627 StringRef OutputFileName,
628 ArrayRef Replacements) {
629 assert(InputBinaries.size() == 1 && "Incorrect number of input binaries");
630 assert(!OutputFileName.empty() && "Replace expects a single output file");
631
632 if (InputBinaries.front().getBinary()->isMachO())
633 reportError("input file " +
634 InputBinaries.front().getBinary()->getFileName() +
635 " must be a fat file when the -replace option is specified");
636
637 SmallVector ReplacementFiles;
638 for (const auto &R : Replacements)
639 ReplacementFiles.push_back(R.FileName);
640 SmallVector, 1> ReplacementBinaries =
641 readInputBinaries(ReplacementFiles);
642
643 StringMap ReplacementSlices =
644 buildReplacementSlices(ReplacementBinaries, Replacements);
645 SmallVector, 2> ExtractedObjects;
646 SmallVector Slices = buildSlices(InputBinaries, ExtractedObjects);
647
648 for (auto &Slice : Slices) {
649 auto It = ReplacementSlices.find(getArchString(*Slice.ObjectFile));
650 if (It != ReplacementSlices.end()) {
651 Slice = It->second;
652 ReplacementSlices.erase(It); // only keep remaining replacing arch_types
653 }
654 }
655
656 if (!ReplacementSlices.empty())
657 reportError("-replace " + ReplacementSlices.begin()->first() +
658 " specified but fat file: " +
659 InputBinaries.front().getBinary()->getFileName() +
660 " does not contain that architecture");
661 createUniversalBinary(Slices, OutputFileName);
662 exit(EXIT_SUCCESS);
663 }
664
559665 int main(int argc, char **argv) {
560666 InitLLVM X(argc, argv);
561667 Config C = parseLipoOptions(makeArrayRef(argv + 1, argc));
578684 case LipoAction::CreateUniversal:
579685 createUniversalBinary(InputBinaries, C.OutputFile);
580686 break;
687 case LipoAction::ReplaceArch:
688 replaceSlices(InputBinaries, C.OutputFile, C.Replacements);
689 break;
581690 }
582691 return EXIT_SUCCESS;
583692 }