1## This test checks that a universal bitcode file is flattened correctly. 2 3# RUN: llvm-as %S/Inputs/arm64-ios.ll -o %t-arm64.bc 4# RUN: llvm-as %S/Inputs/x86_64-osx.ll -o %t-x86_64.bc 5# RUN: llvm-as %S/Inputs/x86_64-osx-2.ll -o %t-x86_64-2.bc 6# RUN: llvm-lipo %t-arm64.bc %t-x86_64.bc -create -output %t-universal.o 7 8# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only arm64 9 10## Check that the binary is present: 11# RUN: llvm-ar t %t.lib | \ 12# RUN: FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp 13 14# CHECK-NAMES: [[PREFIX]]-universal.o 15 16## Check that symbols are present: 17# RUN: llvm-nm --print-armap %t.lib | \ 18# RUN: FileCheck %s --check-prefix=CHECK-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines 19 20# CHECK-SYMBOLS: Archive map 21# CHECK-SYMBOLS-NEXT: _arm64 in [[PREFIX]]-universal.o 22# CHECK-SYMBOLS-EMPTY: 23 24## Check that the output archive is in Darwin format: 25# RUN: llvm-objdump --macho --archive-headers %t.lib | \ 26# RUN: FileCheck %s --check-prefix=FORMAT -DPREFIX=%basename_t.tmp -DARCHIVE=%t.lib 27 28# FORMAT: Archive : [[ARCHIVE]] 29# FORMAT-NEXT: __.SYMDEF 30# FORMAT-NEXT: [[PREFIX]]-universal.o 31# FORMAT-NOT: {{.}} 32 33## Passing both a universal file and a bitcode file: 34# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o %t-x86_64-2.bc -arch_only x86_64 35# RUN: llvm-ar t %t.lib | \ 36# RUN: FileCheck %s --check-prefix=BOTH-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp 37# RUN: llvm-nm --print-armap %t.lib | \ 38# RUN: FileCheck %s --check-prefix=BOTH-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines 39 40# BOTH-NAMES: [[PREFIX]]-universal.o 41# BOTH-NAMES-NEXT: [[PREFIX]]-x86_64-2.bc 42 43# BOTH-SYMBOLS: Archive map 44# BOTH-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-universal.o 45# BOTH-SYMBOLS-NEXT: _x86_64_2 in [[PREFIX]]-x86_64-2.bc 46# BOTH-SYMBOLS-EMPTY: 47 48## Passing both a universal file and a bitcode file but filtering out the object file: 49# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o %t-x86_64.bc -arch_only arm64 50# RUN: llvm-ar t %t.lib | \ 51# RUN: FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp 52# RUN: llvm-nm --print-armap %t.lib | \ 53# RUN: FileCheck %s --check-prefix=CHECK-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines 54 55## Universal file containing an archive: 56# RUN: rm -f %t.ar 57# RUN: llvm-ar cr %t.ar %t-x86_64.bc %t-x86_64-2.bc 58# RUN: llvm-lipo %t.ar -create -output %t-fat-with-archive.o 59# RUN: llvm-libtool-darwin -static -o %t.lib %t-fat-with-archive.o 60# RUN: llvm-ar t %t.lib | \ 61# RUN: FileCheck %s --check-prefix=ARCHIVE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp 62# RUN: llvm-nm --print-armap %t.lib | \ 63# RUN: FileCheck %s --check-prefix=ARCHIVE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines 64 65# ARCHIVE-NAMES: [[PREFIX]]-x86_64.bc 66# ARCHIVE-NAMES-NEXT: [[PREFIX]]-x86_64-2.bc 67 68# ARCHIVE-SYMBOLS: Archive map 69# ARCHIVE-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-x86_64.bc 70# ARCHIVE-SYMBOLS-NEXT: _x86_64_2 in [[PREFIX]]-x86_64-2.bc 71# ARCHIVE-SYMBOLS-EMPTY: 72 73## Allow arch_only to be specified more than once (pick the last one): 74# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only arm64 -arch_only x86_64 75# RUN: llvm-ar t %t.lib | \ 76# RUN: FileCheck %s --check-prefix=DOUBLE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp 77# RUN: llvm-nm --print-armap %t.lib | \ 78# RUN: FileCheck %s --check-prefix=DOUBLE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines 79 80# DOUBLE-NAMES: [[PREFIX]]-universal.o 81 82# DOUBLE-SYMBOLS: Archive map 83# DOUBLE-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-universal.o 84# DOUBLE-SYMBOLS-EMPTY: 85 86 87