llvm-project
45 строк · 2.0 Кб
1# REQUIRES: x86,aarch64
2## FIXME: The tests doesn't run on windows right now because of llvm-mc (can't produce triple=arm64-apple-macos11.0)
3# UNSUPPORTED: system-windows
4
5# RUN: llvm-mc -filetype=obj -triple=i386-apple-darwin %s -o %t.i386.o
6# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.x86_64.o
7# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos11.0 %s -o %t.arm64.o
8
9# RUN: llvm-lipo %t.i386.o %t.x86_64.o -create -o %t.fat.o
10# RUN: %lld -o /dev/null %t.fat.o
11# RUN: llvm-lipo %t.i386.o -create -o %t.noarch.o
12# RUN: not %no-fatal-warnings-lld -o /dev/null %t.noarch.o 2>&1 | \
13# RUN: FileCheck %s -DFILE=%t.noarch.o
14# CHECK: warning: [[FILE]]: ignoring file because it is universal (i386) but does not contain the x86_64 architecture
15
16# RUN: not %lld -arch arm64 -o /dev/null %t.fat.o 2>&1 | \
17# RUN: FileCheck --check-prefix=CHECK-FAT %s -DFILE=%t.fat.o
18# CHECK-FAT: error: [[FILE]]: ignoring file because it is universal (i386,x86_64) but does not contain the arm64 architecture
19
20## Validates that we read the cpu-subtype correctly from a fat exec.
21# RUN: %lld -o %t.x86_64.out %t.x86_64.o
22# RUN: %lld -arch arm64 -o %t.arm64.out %t.arm64.o
23# RUN: llvm-lipo %t.x86_64.out %t.arm64.out -create -o %t.fat.exec.out
24# RUN: %lld -arch x86_64 %t.x86_64.o -bundle_loader %t.fat.exec.out -bundle -o %t.fat.bundle
25
26# RUN: llvm-otool -h %t.fat.bundle > %t.bundle_header.txt
27# RUN: llvm-otool -f %t.fat.exec.out >> %t.bundle_header.txt
28# RUN: cat %t.bundle_header.txt | FileCheck %s --check-prefix=CPU-SUB
29
30# CPU-SUB: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
31# CPU-SUB-NEXT: 0xfeedfacf 16777223 3 0x{{.+}} {{.+}} {{.+}} {{.+}} {{.+}}
32
33# CPU-SUB: Fat headers
34# CPU-SUB: nfat_arch 2
35# CPU-SUB: architecture 0
36# CPU-SUB-NEXT: cputype 16777223
37# CPU-SUB-NEXT: cpusubtype 3
38# CPU-SUB: architecture 1
39# CPU-SUB-NEXT: cputype 16777228
40# CPU-SUB-NEXT: cpusubtype 0
41
42.text
43.global _main
44_main:
45ret
46