2015-10-12 04:59:12 +08:00
|
|
|
// REQUIRES: x86
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared.s -o %t2.o
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared2.s -o %t3.o
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared3.s -o %t4.o
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld -shared %t2.o -soname shared1 -o %t2.so
|
|
|
|
// RUN: ld.lld -shared %t3.o -soname shared2 -o %t3.so
|
|
|
|
// RUN: ld.lld -shared %t4.o -soname shared3 -o %t4.so
|
2015-10-12 04:59:12 +08:00
|
|
|
|
|
|
|
/// Check if --as-needed actually works.
|
|
|
|
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld %t.o %t2.so %t3.so %t4.so -o %t2
|
2015-10-12 04:59:12 +08:00
|
|
|
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s
|
|
|
|
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld --as-needed %t.o %t2.so %t3.so %t4.so -o %t2
|
2015-10-12 04:59:12 +08:00
|
|
|
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s
|
|
|
|
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld --as-needed %t.o %t2.so --no-as-needed %t3.so %t4.so -o %t2
|
2015-10-12 04:59:12 +08:00
|
|
|
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s
|
|
|
|
|
|
|
|
/// GROUP directive is the same as --as-needed.
|
|
|
|
|
2016-02-03 05:03:56 +08:00
|
|
|
// RUN: echo "GROUP(\"%t2.so\" \"%t3.so\" \"%t4.so\")" > %t.script
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld %t.o %t.script -o %t2
|
2015-10-12 04:59:12 +08:00
|
|
|
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s
|
|
|
|
|
2016-02-03 05:03:56 +08:00
|
|
|
// RUN: echo "GROUP(AS_NEEDED(\"%t2.so\" \"%t3.so\" \"%t4.so\"))" > %t.script
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld %t.o %t.script -o %t2
|
2015-10-12 04:59:12 +08:00
|
|
|
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s
|
|
|
|
|
|
|
|
// CHECK: NEEDED SharedLibrary (shared1)
|
|
|
|
// CHECK: NEEDED SharedLibrary (shared2)
|
|
|
|
// CHECK: NEEDED SharedLibrary (shared3)
|
|
|
|
|
|
|
|
// CHECK2: NEEDED SharedLibrary (shared1)
|
|
|
|
// CHECK2-NOT: NEEDED SharedLibrary (shared2)
|
|
|
|
// CHECK2-NOT: NEEDED SharedLibrary (shared3)
|
|
|
|
|
|
|
|
.global _start
|
|
|
|
_start:
|
2016-04-30 08:49:10 +08:00
|
|
|
.data
|
2015-10-12 04:59:12 +08:00
|
|
|
.long bar
|
|
|
|
.long zed
|
|
|
|
.weak baz
|
2015-10-13 00:25:33 +08:00
|
|
|
call baz
|