File: universal-bitcode-flattening.test

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (86 lines) | stat: -rw-r--r-- 3,675 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
## This test checks that a universal bitcode file is flattened correctly.

# RUN: llvm-as %S/Inputs/arm64-ios.ll -o %t-arm64.bc
# RUN: llvm-as %S/Inputs/x86_64-osx.ll -o %t-x86_64.bc
# RUN: llvm-as %S/Inputs/x86_64-osx-2.ll -o %t-x86_64-2.bc
# RUN: llvm-lipo %t-arm64.bc %t-x86_64.bc -create -output %t-universal.o

# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only arm64

## Check that the binary is present:
# RUN: llvm-ar t %t.lib | \
# RUN:   FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp

# CHECK-NAMES: [[PREFIX]]-universal.o

## Check that symbols are present:
# RUN: llvm-nm --print-armap %t.lib | \
# RUN:   FileCheck %s --check-prefix=CHECK-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines

# CHECK-SYMBOLS:      Archive map
# CHECK-SYMBOLS-NEXT: _arm64 in [[PREFIX]]-universal.o
# CHECK-SYMBOLS-EMPTY:

## Check that the output archive is in Darwin format:
# RUN: llvm-objdump --macho --archive-headers %t.lib | \
# RUN:   FileCheck %s --check-prefix=FORMAT -DPREFIX=%basename_t.tmp -DARCHIVE=%t.lib

# FORMAT:      Archive : [[ARCHIVE]]
# FORMAT-NEXT: __.SYMDEF
# FORMAT-NEXT: [[PREFIX]]-universal.o
# FORMAT-NOT:  {{.}}

## Passing both a universal file and a bitcode file:
# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o %t-x86_64-2.bc -arch_only x86_64
# RUN: llvm-ar t %t.lib | \
# RUN:   FileCheck %s --check-prefix=BOTH-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp
# RUN: llvm-nm --print-armap %t.lib | \
# RUN:   FileCheck %s --check-prefix=BOTH-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines

# BOTH-NAMES:      [[PREFIX]]-universal.o
# BOTH-NAMES-NEXT: [[PREFIX]]-x86_64-2.bc

# BOTH-SYMBOLS:      Archive map
# BOTH-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-universal.o
# BOTH-SYMBOLS-NEXT: _x86_64_2 in [[PREFIX]]-x86_64-2.bc
# BOTH-SYMBOLS-EMPTY:

## Passing both a universal file and a bitcode file but filtering out the object file:
# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o %t-x86_64.bc -arch_only arm64
# RUN: llvm-ar t %t.lib | \
# RUN:   FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp
# RUN: llvm-nm --print-armap %t.lib | \
# RUN:   FileCheck %s --check-prefix=CHECK-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines

## Universal file containing an archive:
# RUN: rm -f %t.ar
# RUN: llvm-ar cr %t.ar %t-x86_64.bc %t-x86_64-2.bc
# RUN: llvm-lipo %t.ar -create -output %t-fat-with-archive.o
# RUN: llvm-libtool-darwin -static -o %t.lib %t-fat-with-archive.o
# RUN: llvm-ar t %t.lib | \
# RUN:   FileCheck %s --check-prefix=ARCHIVE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp
# RUN: llvm-nm --print-armap %t.lib | \
# RUN:   FileCheck %s --check-prefix=ARCHIVE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines

# ARCHIVE-NAMES:      [[PREFIX]]-x86_64.bc
# ARCHIVE-NAMES-NEXT: [[PREFIX]]-x86_64-2.bc

# ARCHIVE-SYMBOLS:      Archive map
# ARCHIVE-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-x86_64.bc
# ARCHIVE-SYMBOLS-NEXT: _x86_64_2 in [[PREFIX]]-x86_64-2.bc
# ARCHIVE-SYMBOLS-EMPTY:

## Allow arch_only to be specified more than once (pick the last one):
# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only arm64 -arch_only x86_64
# RUN: llvm-ar t %t.lib | \
# RUN:   FileCheck %s --check-prefix=DOUBLE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp
# RUN: llvm-nm --print-armap %t.lib | \
# RUN:   FileCheck %s --check-prefix=DOUBLE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines

# DOUBLE-NAMES: [[PREFIX]]-universal.o

# DOUBLE-SYMBOLS:      Archive map
# DOUBLE-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-universal.o
# DOUBLE-SYMBOLS-EMPTY: