2015-09-28 20:52:21 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: %p/Inputs/libsearch-dyn.s -o %tdyn.o
|
2015-09-28 20:52:21 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: %p/Inputs/libsearch-st.s -o %tst.o
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -shared %tdyn.o -o %T/libls.so
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: cp -f %T/libls.so %T/libls2.so
|
2015-09-28 20:52:21 +08:00
|
|
|
// RUN: rm -f %T/libls.a
|
|
|
|
// RUN: llvm-ar rcs %T/libls.a %tst.o
|
|
|
|
// REQUIRES: x86
|
|
|
|
|
|
|
|
// Should not link because of undefined symbol _bar
|
2015-10-09 04:57:29 +08:00
|
|
|
// RUN: not ld.lld2 -o %t3 %t.o 2>&1 \
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=UNDEFINED %s
|
2015-09-28 20:52:21 +08:00
|
|
|
// UNDEFINED: undefined symbol: _bar
|
|
|
|
|
|
|
|
// Should fail if cannot find specified library (without -L switch)
|
2015-10-09 04:57:29 +08:00
|
|
|
// RUN: not ld.lld2 -o %t3 %t.o -lls 2>&1 \
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=NOLIB %s
|
2015-09-28 20:52:21 +08:00
|
|
|
// NOLIB: Unable to find library -lls
|
|
|
|
|
|
|
|
// Should use explicitly specified static library
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -l:libls.a
|
2015-09-28 20:52:21 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s
|
|
|
|
// STATIC: Symbols [
|
|
|
|
// STATIC: Name: _static
|
|
|
|
// STATIC: ]
|
|
|
|
|
|
|
|
// Should use explicitly specified dynamic library
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -l:libls.so
|
2015-09-28 20:52:21 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s
|
|
|
|
// DYNAMIC: Symbols [
|
|
|
|
// DYNAMIC-NOT: Name: _static
|
|
|
|
// DYNAMIC: ]
|
|
|
|
|
|
|
|
// Should prefer dynamic to static
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -lls
|
2015-09-28 20:52:21 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s
|
|
|
|
|
|
|
|
// -L can be placed after -l
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -lls -L%T
|
2015-09-28 20:52:21 +08:00
|
|
|
|
|
|
|
// Check long forms as well
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o --library-path=%T --library=ls
|
2015-09-28 20:52:21 +08:00
|
|
|
|
2015-10-02 00:42:03 +08:00
|
|
|
// Should not search for dynamic libraries if -Bstatic is specified
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -Bstatic -lls
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s
|
2015-10-09 04:57:29 +08:00
|
|
|
// RUN: not ld.lld2 -o %t3 %t.o -L%T -Bstatic -lls2 2>&1 \
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=NOLIB2 %s
|
|
|
|
// NOLIB2: Unable to find library -lls2
|
|
|
|
|
|
|
|
// -Bdynamic should restore default behaviour
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -Bstatic -Bdynamic -lls
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s
|
|
|
|
|
|
|
|
// -Bstatic and -Bdynamic should affect only libraries which follow them
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -lls -Bstatic -Bdynamic
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -Bstatic -lls -Bdynamic
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s
|
|
|
|
|
|
|
|
// Check aliases as well
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -dn -lls
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -non_shared -lls
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -static -lls
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -Bstatic -dy -lls
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s
|
2015-10-08 01:31:39 +08:00
|
|
|
// RUN: ld.lld2 -o %t3 %t.o -L%T -Bstatic -call_shared -lls
|
2015-10-02 00:42:03 +08:00
|
|
|
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s
|
|
|
|
|
2015-09-28 20:52:21 +08:00
|
|
|
.globl _start,_bar;
|
|
|
|
_start:
|