150
|
1 // REQUIRES: x86
|
|
2
|
|
3 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
|
|
4 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
|
|
5 // RUN: %p/Inputs/whole-archive.s -o %t2.o
|
|
6 // RUN: rm -f %t.a
|
|
7 // RUN: llvm-ar rcs %t.a %t2.o
|
|
8
|
|
9 // RUN: ld.lld -o %t.exe -push-state -whole-archive %t.a %t1.o -M | \
|
|
10 // RUN: FileCheck -check-prefix=WHOLE %s
|
|
11 // WHOLE: _bar
|
|
12
|
|
13 // RUN: ld.lld -o %t.exe -push-state -whole-archive -pop-state %t.a %t1.o -M | \
|
|
14 // RUN: FileCheck -check-prefix=NO-WHOLE %s
|
|
15 // NO-WHOLE-NOT: _bar
|
|
16
|
|
17
|
|
18 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t3.o
|
|
19 // RUN: ld.lld -shared %t3.o -soname libfoo -o %t.so
|
|
20
|
|
21 // RUN: ld.lld -o %t.exe -push-state -as-needed %t.so %t1.o
|
|
22 // RUN: llvm-readobj --dynamic-table %t.exe | FileCheck -check-prefix=AS-NEEDED %s
|
|
23 // AS-NEEDED-NOT: NEEDED Shared library: [libfoo]
|
|
24
|
|
25 // RUN: ld.lld -o %t.exe -push-state -as-needed -pop-state %t.so %t1.o
|
|
26 // RUN: llvm-readobj --dynamic-table %t.exe | FileCheck -check-prefix=NO-AS-NEEDED %s
|
|
27 // NO-AS-NEEDED: NEEDED Shared library: [libfoo]
|
|
28
|
|
29
|
|
30 // RUN: mkdir -p %t.dir
|
|
31 // RUN: cp %t.so %t.dir/libfoo.so
|
|
32 // RUN: ld.lld -o %t.exe -L%t.dir -push-state -static -pop-state %t1.o -lfoo
|
173
|
33 // RUN: not ld.lld -o /dev/null -L%t.dir -push-state -static %t1.o -lfoo
|
150
|
34
|
173
|
35 // RUN: not ld.lld -o /dev/null -pop-state %t.a %t1.o -M 2>&1 | FileCheck -check-prefix=ERR %s
|
150
|
36 // ERR: error: unbalanced --push-state/--pop-state
|
|
37
|
|
38 .globl _start
|
|
39 _start:
|