1 ## This test checks that a universal bitcode file is flattened correctly.
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
8 # RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only arm64
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
14 # CHECK-NAMES: [[PREFIX]]-universal.o
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
20 # CHECK-SYMBOLS: Archive map
21 # CHECK-SYMBOLS-NEXT: _arm64 in [[PREFIX]]-universal.o
22 # CHECK-SYMBOLS-EMPTY:
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
28 # FORMAT: Archive : [[ARCHIVE]]
29 # FORMAT-NEXT: __.SYMDEF
30 # FORMAT-NEXT: [[PREFIX]]-universal.o
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
40 # BOTH-NAMES: [[PREFIX]]-universal.o
41 # BOTH-NAMES-NEXT: [[PREFIX]]-x86_64-2.bc
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
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
55 ## Universal file containing an archive:
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
65 # ARCHIVE-NAMES: [[PREFIX]]-x86_64.bc
66 # ARCHIVE-NAMES-NEXT: [[PREFIX]]-x86_64-2.bc
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:
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
80 # DOUBLE-NAMES: [[PREFIX]]-universal.o
82 # DOUBLE-SYMBOLS: Archive map
83 # DOUBLE-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-universal.o
84 # DOUBLE-SYMBOLS-EMPTY: