[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / as-needed.s
blob1623f324892b49bf59aed771c309a3de6fb24df9
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o
3 // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared.s -o %t2.o
4 // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared2.s -o %t3.o
5 // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared3.s -o %t4.o
6 // RUN: ld.lld -shared %t2.o -soname shared1 -o %t2.so
7 // RUN: ld.lld -shared %t3.o -soname shared2 -o %t3.so
8 // RUN: ld.lld -shared %t4.o -soname shared3 -o %t4.so
10 /// Check if --as-needed actually works.
12 // RUN: ld.lld %t.o %t2.so %t3.so %t4.so -o %t2
13 // RUN: llvm-readobj --dynamic-table %t2 | FileCheck %s
15 // RUN: ld.lld --as-needed %t.o %t2.so %t3.so %t4.so -o %t2
16 // RUN: llvm-readobj --dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s
18 // Test with the .o last
19 // RUN: ld.lld --as-needed %t2.so %t3.so %t4.so %t.o -o %t2
20 // RUN: llvm-readobj --dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s
22 // RUN: ld.lld --as-needed %t.o %t2.so --no-as-needed %t3.so %t4.so -o %t2
23 // RUN: llvm-readobj --dynamic-table %t2 | FileCheck %s
25 /// GROUP command is the same as listing the files on the command line.
27 // RUN: echo "GROUP(\"%t2.so\" \"%t3.so\" \"%t4.so\")" > %t.script
28 // RUN: ld.lld %t.o %t.script -o %t2
29 // RUN: llvm-readobj --dynamic-table %t2 | FileCheck %s
31 // RUN: echo "GROUP(AS_NEEDED(\"%t2.so\" \"%t3.so\" \"%t4.so\"))" > %t.script
32 // RUN: ld.lld %t.o %t.script -o %t2
33 // RUN: llvm-readobj --dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s
35 // CHECK: NEEDED Shared library: [shared1]
36 // CHECK: NEEDED Shared library: [shared2]
37 // CHECK: NEEDED Shared library: [shared3]
39 // CHECK2: NEEDED Shared library: [shared1]
40 // CHECK2-NOT: NEEDED Shared library: [shared2]
41 // CHECK2-NOT: NEEDED Shared library: [shared3]
43 .global _start
44 _start:
45 .data
46 .long bar
47 .long zed
48 .weak baz
49 call baz