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