1*05f7b682SPaul-Antoine Arras## This test checks that a correct universal binary is produced when 2*05f7b682SPaul-Antoine Arras## llvm-libtool-darwin is given bitcode for multiple architectures. 3*05f7b682SPaul-Antoine Arras 4*05f7b682SPaul-Antoine Arras## Check that the subtypes of cputype CPU_TYPE_ARM are stored in a fat file: 5*05f7b682SPaul-Antoine Arras# RUN: llvm-as %p/Inputs/arm64-ios.ll -o %t-arm64.bc 6*05f7b682SPaul-Antoine Arras# RUN: llvm-as %p/Inputs/armv7-ios.ll -o %t-armv7.bc 7*05f7b682SPaul-Antoine Arras 8*05f7b682SPaul-Antoine Arras# RUN: llvm-libtool-darwin -static -o %t.lib %t-arm64.bc %t-armv7.bc 9*05f7b682SPaul-Antoine Arras 10*05f7b682SPaul-Antoine Arras## Check that architectures are present in the universal output: 11*05f7b682SPaul-Antoine Arras# RUN: llvm-lipo -info %t.lib | \ 12*05f7b682SPaul-Antoine Arras# RUN: FileCheck %s --check-prefix=ARCHS -DFILE=%t.lib 13*05f7b682SPaul-Antoine Arras 14*05f7b682SPaul-Antoine Arras# ARCHS: Architectures in the fat file: [[FILE]] are: armv7 arm64 15*05f7b682SPaul-Antoine Arras 16*05f7b682SPaul-Antoine Arras## Check that the files with the same architecture are combined in an archive: 17*05f7b682SPaul-Antoine Arras# RUN: llvm-libtool-darwin -static -o %t.lib %t-arm64.bc %t-arm64.bc %t-armv7.bc 18*05f7b682SPaul-Antoine Arras# RUN: llvm-lipo -info %t.lib | \ 19*05f7b682SPaul-Antoine Arras# RUN: FileCheck %s --check-prefix=ARCHS -DFILE=%t.lib 20*05f7b682SPaul-Antoine Arras# RUN: llvm-objdump --macho --arch all --all-headers %t.lib | \ 21*05f7b682SPaul-Antoine Arras# RUN: FileCheck %s --check-prefix=UNIVERSAL-MEMBERS -DFILE=%t.lib -DPREFIX=%basename_t.tmp --implicit-check-not=Archive 22*05f7b682SPaul-Antoine Arras 23*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS: Archive : [[FILE]] (architecture armv7) 24*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-NEXT: __.SYMDEF 25*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-NEXT: [[PREFIX]]-armv7.bc 26*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS: Archive : [[FILE]] (architecture arm64) 27*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-NEXT: __.SYMDEF 28*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-NEXT: [[PREFIX]]-arm64.bc 29*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-NEXT: [[PREFIX]]-arm64.bc 30*05f7b682SPaul-Antoine Arras 31*05f7b682SPaul-Antoine Arras## Check that the files extracted from a universal output are archives: 32*05f7b682SPaul-Antoine Arras# RUN: llvm-libtool-darwin -static -o %t.lib %t-arm64.bc %t-armv7.bc 33*05f7b682SPaul-Antoine Arras# RUN: llvm-lipo %t.lib -thin armv7 -output %t-extracted-v7.a 34*05f7b682SPaul-Antoine Arras# RUN: llvm-ar t %t-extracted-v7.a | \ 35*05f7b682SPaul-Antoine Arras# RUN: FileCheck %s --check-prefix=EXTRACT --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp 36*05f7b682SPaul-Antoine Arras# RUN: llvm-nm --print-armap %t-extracted-v7.a | \ 37*05f7b682SPaul-Antoine Arras# RUN: FileCheck %s --check-prefix=EXTRACT-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines 38*05f7b682SPaul-Antoine Arras 39*05f7b682SPaul-Antoine Arras# EXTRACT: [[PREFIX]]-armv7.bc 40*05f7b682SPaul-Antoine Arras 41*05f7b682SPaul-Antoine Arras# EXTRACT-SYMBOLS: Archive map 42*05f7b682SPaul-Antoine Arras# EXTRACT-SYMBOLS-NEXT: _armv7 in [[PREFIX]]-armv7.bc 43*05f7b682SPaul-Antoine Arras# EXTRACT-SYMBOLS-EMPTY: 44*05f7b682SPaul-Antoine Arras 45*05f7b682SPaul-Antoine Arras## Check that the subtypes of cputype CPU_TYPE_X86_64 are stored in a fat file: 46*05f7b682SPaul-Antoine Arras# RUN: llvm-as %p/Inputs/x86_64-osx.ll -o %t-x86_64.bc 47*05f7b682SPaul-Antoine Arras# RUN: llvm-as %p/Inputs/x86_64h-osx.ll -o %t-x86_64_h.bc 48*05f7b682SPaul-Antoine Arras# RUN: llvm-libtool-darwin -static -o %t.lib %t-x86_64.bc %t-x86_64_h.bc 49*05f7b682SPaul-Antoine Arras# RUN: llvm-lipo -info %t.lib | \ 50*05f7b682SPaul-Antoine Arras# RUN: FileCheck %s --check-prefix=ARCHS-X86 -DFILE=%t.lib 51*05f7b682SPaul-Antoine Arras 52*05f7b682SPaul-Antoine Arras# ARCHS-X86: Architectures in the fat file: [[FILE]] are: x86_64 x86_64h 53*05f7b682SPaul-Antoine Arras 54*05f7b682SPaul-Antoine Arras## Check that the subtypes of cputype CPU_TYPE_ARM64 are stored in a fat file: 55*05f7b682SPaul-Antoine Arras## Testing it using llvm-objdump as, currently, there is no support for arm64e 56*05f7b682SPaul-Antoine Arras## under llvm/lib/Object/MachOObjectFile.cpp. 57*05f7b682SPaul-Antoine Arras# RUN: llvm-as %p/Inputs/arm64e-ios.ll -o %t-arm64e.bc 58*05f7b682SPaul-Antoine Arras# RUN: llvm-libtool-darwin -static -o %t.lib %t-arm64.bc %t-arm64e.bc 59*05f7b682SPaul-Antoine Arras# RUN: llvm-objdump --macho --arch all --all-headers %t.lib | \ 60*05f7b682SPaul-Antoine Arras# RUN: FileCheck %s --check-prefix=UNIVERSAL-MEMBERS-ARM64 -DFILE=%t.lib -DPREFIX=%basename_t.tmp --implicit-check-not=Archive 61*05f7b682SPaul-Antoine Arras 62*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-ARM64: Archive : [[FILE]] (architecture arm64) 63*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-ARM64-NEXT: __.SYMDEF 64*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-ARM64-NEXT: [[PREFIX]]-arm64.bc 65*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-ARM64: Archive : [[FILE]] 66*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-ARM64-NEXT: __.SYMDEF 67*05f7b682SPaul-Antoine Arras# UNIVERSAL-MEMBERS-ARM64-NEXT: [[PREFIX]]-arm64e.bc 68*05f7b682SPaul-Antoine Arras 69*05f7b682SPaul-Antoine Arras## Check that different cputypes are stored together in a fat file: 70*05f7b682SPaul-Antoine Arras# RUN: llvm-libtool-darwin -static -o %t.lib %t-armv7.bc %t-x86_64.bc 71*05f7b682SPaul-Antoine Arras# RUN: llvm-lipo -info %t.lib | \ 72*05f7b682SPaul-Antoine Arras# RUN: FileCheck %s --check-prefix=ARCHS-CPU -DFILE=%t.lib 73*05f7b682SPaul-Antoine Arras 74*05f7b682SPaul-Antoine Arras# ARCHS-CPU: Architectures in the fat file: [[FILE]] are: armv7 x86_64 75*05f7b682SPaul-Antoine Arras 76