File: create-static-lib.test

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (70 lines) | stat: -rw-r--r-- 2,863 bytes parent folder | download | duplicates (3)
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
## This test checks that a correct static library is created.

# RUN: yaml2obj %S/Inputs/input1.yaml -o %t-input1.o
# RUN: yaml2obj %S/Inputs/input2.yaml -o %t-input2.o
# RUN: llvm-as %S/Inputs/x86_64-osx.ll -o %t-x86_64.bc

# RUN: rm -rf %t.lib
# RUN: llvm-libtool-darwin -static -o %t.lib %t-input1.o %t-input2.o %t-x86_64.bc

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

# CHECK-NAMES:      [[PREFIX]]-input1.o
# CHECK-NAMES-NEXT: [[PREFIX]]-input2.o
# CHECK-NAMES-NEXT: [[PREFIX]]-x86_64.bc

## 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: _symbol1 in [[PREFIX]]-input1.o
# CHECK-SYMBOLS-NEXT: _symbol2 in [[PREFIX]]-input2.o
# CHECK-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-x86_64.bc
# CHECK-SYMBOLS-EMPTY:

## Check that 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

# FORMAT:      Archive : [[ARCHIVE]]
# FORMAT-NEXT: __.SYMDEF
# FORMAT-NEXT: [[PREFIX]]-input1.o
# FORMAT-NEXT: [[PREFIX]]-input2.o
# FORMAT-NEXT: [[PREFIX]]-x86_64.bc
# FORMAT-NOT:  {{.}}

## Check that the output file is overwritten:
# RUN: llvm-libtool-darwin -static -o %t.lib %t-input2.o
# RUN: llvm-ar t %t.lib | \
# RUN:   FileCheck %s --check-prefix=OVERWRITE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp
# RUN: llvm-nm --print-armap %t.lib | \
# RUN:   FileCheck %s --check-prefix=OVERWRITE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines

# OVERWRITE-NAMES: [[PREFIX]]-input2.o

# OVERWRITE-SYMBOLS:      Archive map
# OVERWRITE-SYMBOLS-NEXT: _symbol2 in [[PREFIX]]-input2.o
# OVERWRITE-SYMBOLS-EMPTY:

## Duplicate a binary:
## cctools' libtool raises a warning in this case.
## The warning is not yet implemented for llvm-libtool-darwin.
# RUN: llvm-libtool-darwin -static -o %t.lib %t-input1.o %t-input2.o %t-input1.o 2>&1 | \
# RUN:   FileCheck %s --allow-empty --implicit-check-not={{.}}
# RUN: llvm-ar t %t.lib | \
# RUN:   FileCheck %s --check-prefix=DUPLICATE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp
# RUN: llvm-nm --print-armap %t.lib | \
# RUN:   FileCheck %s --check-prefix=DUPLICATE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines

# DUPLICATE-NAMES:      [[PREFIX]]-input1.o
# DUPLICATE-NAMES-NEXT: [[PREFIX]]-input2.o
# DUPLICATE-NAMES-NEXT: [[PREFIX]]-input1.o

# DUPLICATE-SYMBOLS:      Archive map
# DUPLICATE-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o
# DUPLICATE-SYMBOLS-NEXT: _symbol2 in [[PREFIX]]-input2.o
# DUPLICATE-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o
# DUPLICATE-SYMBOLS-EMPTY: