1# REQUIRES: x86, aarch64, arm
2# RUN: rm -rf %t && mkdir -p %t
3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/x86-64-test.o
4# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t/arm64-test.o
5# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos %s -o %t/arm64-32-test.o
6# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos %s -o %t/arm64-32-test.o
7# RUN: llvm-mc -filetype=obj -triple=armv7-apple-watchos %s -o %t/arm-test.o
8
9# RUN: %lld -lSystem -arch x86_64 -o %t/x86-64-executable %t/x86-64-test.o
10# RUN: %lld -lSystem -arch arm64 -o %t/arm64-executable %t/arm64-test.o
11# RUN: %lld-watchos -lSystem -o %t/arm64-32-executable %t/arm64-32-test.o
12# RUN: %lld-watchos -lSystem -arch armv7 -o %t/arm-executable %t/arm-test.o
13
14# RUN: %lld -arch x86_64 -dylib -o %t/x86-64-dylib %t/x86-64-test.o
15
16## NOTE: recent versions of ld64 don't emit LIB64 for x86-64-executable, maybe we should follow suit
17# RUN: llvm-objdump --macho --private-header %t/x86-64-executable | FileCheck %s --check-prefix=EXEC -DCPU=X86_64 -DSUBTYPE=ALL -DCAPS=LIB64
18# RUN: llvm-objdump --macho --private-header %t/arm64-executable | FileCheck %s --check-prefix=EXEC -DCPU=ARM64 -DSUBTYPE=ALL -DCAPS=0x00
19# RUN: llvm-objdump --macho --private-header %t/arm64-32-executable | FileCheck %s --check-prefix=EXEC -DCPU=ARM64_32 -DSUBTYPE=V8 -DCAPS=0x00
20# RUN: llvm-objdump --macho --private-header %t/arm-executable | FileCheck %s  --check-prefix=EXEC -DCPU=ARM -DSUBTYPE=V7 -DCAPS=0x00
21
22# RUN: llvm-objdump --macho --private-header %t/x86-64-dylib | FileCheck %s --check-prefix=DYLIB -DCPU=X86_64 -DSUBTYPE=ALL -DCAPS=0x00
23
24# EXEC:      magic               cputype  cpusubtype   caps     filetype {{.*}} flags
25# EXEC-NEXT: MH_MAGIC{{(_64)?}}  [[CPU]]  [[SUBTYPE]]  [[CAPS]] EXECUTE  {{.*}} NOUNDEFS DYLDLINK TWOLEVEL PIE{{$}}
26
27# DYLIB:      magic                  cputype  cpusubtype   caps      filetype {{.*}} flags
28# DYLIB-NEXT: MH_MAGIC_64{{(_64)?}}  [[CPU]]  [[SUBTYPE]]  [[CAPS]]  DYLIB    {{.*}} NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS{{$}}
29
30.globl _main
31_main:
32