1# RUN: yaml2obj %p/Inputs/arm64-slice.yaml -o %t-arm64.o
2# RUN: yaml2obj %p/Inputs/armv7-slice.yaml -o %t-armv7.o
3# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o
4
5# segalign expects an architecture type followed by a hexadecimal value for alignment
6
7# RUN: llvm-lipo %t-universal.o %t-arm64.o -create -o %t.o -segalign arm64 100
8# RUN: llvm-objdump %t.o -m --universal-headers | FileCheck --check-prefix=CHECK_SMALL_ARM64 %s
9# CHECK_SMALL_ARM64: nfat_arch 3
10# CHECK_SMALL_ARM64-NEXT: architecture i386
11# CHECK_SMALL_ARM64: offset 4096
12# CHECK_SMALL_ARM64-NEXT: size 432
13# CHECK_SMALL_ARM64-NEXT: align 2^12 (4096)
14# CHECK_SMALL_ARM64-NEXT: architecture x86_64
15# CHECK_SMALL_ARM64: offset 8192
16# CHECK_SMALL_ARM64-NEXT: size 488
17# CHECK_SMALL_ARM64-NEXT: align 2^12 (4096)
18# CHECK_SMALL_ARM64-NEXT: architecture arm64
19# CHECK_SMALL_ARM64: offset 8704
20# CHECK_SMALL_ARM64-NEXT: size 516
21# CHECK_SMALL_ARM64-NEXT: align 2^8 (256)
22######     WITHOUT SEGALIGN      ######
23# RUN: llvm-lipo %t-universal.o %t-arm64.o -create -o %t-nosegalign.o
24# RUN: llvm-objdump %t-nosegalign.o -m --universal-headers | FileCheck --check-prefix=CHECK_SMALL_ARM64_NO_SEGALIGN %s
25# CHECK_SMALL_ARM64_NO_SEGALIGN: architecture arm64
26# CHECK_SMALL_ARM64_NO_SEGALIGN: offset 16384
27# CHECK_SMALL_ARM64_NO_SEGALIGN-NEXT: size 516
28# CHECK_SMALL_ARM64_NO_SEGALIGN-NEXT: align 2^14 (16384)
29
30# RUN: llvm-lipo %t.o -thin arm64 -o %thin-arm64.o
31# RUN: cmp %thin-arm64.o %t-arm64.o
32
33# RUN: llvm-lipo %t-universal.o %t-armv7.o -create -o %t2.o -segalign armv7 100
34# RUN: llvm-objdump %t2.o -m --universal-headers | FileCheck --check-prefix=CHECK_SMALL_ARMV7 %s
35# CHECK_SMALL_ARMV7: nfat_arch 3
36# CHECK_SMALL_ARMV7-NEXT: architecture armv7
37# CHECK_SMALL_ARMV7: offset 256
38# CHECK_SMALL_ARMV7-NEXT: size 304
39# CHECK_SMALL_ARMV7-NEXT: align 2^8 (256)
40# CHECK_SMALL_ARMV7-NEXT: architecture i386
41# CHECK_SMALL_ARMV7: offset 4096
42# CHECK_SMALL_ARMV7-NEXT: size 432
43# CHECK_SMALL_ARMV7-NEXT: align 2^12 (4096)
44# CHECK_SMALL_ARMV7-NEXT: architecture x86_64
45# CHECK_SMALL_ARMV7: offset 8192
46# CHECK_SMALL_ARMV7-NEXT: size 488
47# CHECK_SMALL_ARMV7-NEXT: align 2^12 (4096)
48######     WITHOUT SEGALIGN      ######
49# RUN: llvm-lipo %t-universal.o %t-armv7.o -create -o %t2-nosegalign.o
50# RUN: llvm-objdump %t2-nosegalign.o -m --universal-headers | FileCheck --check-prefix=CHECK_SMALL_ARMV7_NO_SEGALIGN %s
51# CHECK_SMALL_ARMV7_NO_SEGALIGN: nfat_arch 3
52# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: architecture i386
53# CHECK_SMALL_ARMV7_NO_SEGALIGN: offset 4096
54# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: size 432
55# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: align 2^12 (4096)
56# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: architecture x86_64
57# CHECK_SMALL_ARMV7_NO_SEGALIGN: offset 8192
58# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: size 488
59# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: align 2^12 (4096)
60# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: architecture armv7
61# CHECK_SMALL_ARMV7_NO_SEGALIGN: offset 16384
62# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: size 304
63# CHECK_SMALL_ARMV7_NO_SEGALIGN-NEXT: align 2^14 (16384)
64
65# RUN: llvm-lipo %t2.o -thin armv7 -o %thin-armv7.o
66# RUN: cmp %thin-armv7.o %t-armv7.o
67
68# RUN: yaml2obj %p/Inputs/armv7-slice-big.yaml -o %t-armv7-big.o
69# RUN: yaml2obj %p/Inputs/i386-x86_64-armv7-arm64-universal.yaml -o %t-universal-big.o
70
71# RUN: llvm-lipo %t-universal-big.o -replace armv7 %t-armv7-big.o -o %t3.o -segalign armv7 4
72# RUN: llvm-objdump %t3.o -m --universal-headers | FileCheck --check-prefix=CHECK_REPLACE_ARMV7 %s
73# CHECK_REPLACE_ARMV7: nfat_arch 4
74# CHECK_REPLACE_ARMV7-NEXT: architecture armv7
75# CHECK_REPLACE_ARMV7: offset 88
76# CHECK_REPLACE_ARMV7-NEXT: size 88128
77# CHECK_REPLACE_ARMV7-NEXT: align 2^2 (4)
78# CHECK_REPLACE_ARMV7-NEXT: architecture i386
79# CHECK_REPLACE_ARMV7: offset 90112
80# CHECK_REPLACE_ARMV7-NEXT: size 432
81# CHECK_REPLACE_ARMV7-NEXT: align 2^12 (4096)
82# CHECK_REPLACE_ARMV7-NEXT: architecture x86_64
83# CHECK_REPLACE_ARMV7: offset 94208
84# CHECK_REPLACE_ARMV7-NEXT: size 488
85# CHECK_REPLACE_ARMV7-NEXT: align 2^12 (4096)
86# CHECK_REPLACE_ARMV7-NEXT: architecture arm64
87# CHECK_REPLACE_ARMV7: offset 98304
88# CHECK_REPLACE_ARMV7-NEXT: size 516
89# CHECK_REPLACE_ARMV7-NEXT: align 2^14 (16384)
90######     WITHOUT SEGALIGN      ######
91# RUN: llvm-lipo %t-universal-big.o -replace armv7 %t-armv7-big.o -o %t3-nosegalign.o
92# RUN: llvm-objdump %t3-nosegalign.o -m --universal-headers | FileCheck --check-prefix=CHECK_REPLACE_ARMV7_NO_SEGALGIN %s
93# CHECK_REPLACE_ARMV7_NO_SEGALGIN: nfat_arch 4
94# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: architecture i386
95# CHECK_REPLACE_ARMV7_NO_SEGALGIN: offset 4096
96# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: size 432
97# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: align 2^12 (4096)
98# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: architecture x86_64
99# CHECK_REPLACE_ARMV7_NO_SEGALGIN: offset 8192
100# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: size 488
101# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: align 2^12 (4096)
102# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: architecture armv7
103# CHECK_REPLACE_ARMV7_NO_SEGALGIN: offset 16384
104# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: size 88128
105# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: align 2^14 (16384)
106# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: architecture arm64
107# CHECK_REPLACE_ARMV7_NO_SEGALGIN: offset 114688
108# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: size 516
109# CHECK_REPLACE_ARMV7_NO_SEGALGIN-NEXT: align 2^14 (16384)
110
111
112# RUN: llvm-lipo %t3.o -thin armv7 -o %thin-armv7-big.o
113# RUN: cmp %thin-armv7-big.o %t-armv7-big.o
114