blob: 38fd8cdde402aa65d26d1540eead6fe05cd8cf5b [file] [log] [blame]
Igor Kudrin1309fc02015-09-28 15:01:591// RUN: mkdir -p %t/lib
2// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t/m.o
3// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
4// RUN: %p/Inputs/libsearch-st.s -o %t/st.o
5// RUN: rm -f %t/lib/libls.a
6// RUN: llvm-ar rcs %t/lib/libls.a %t/st.o
7// REQUIRES: x86
8
9// Should not link because of undefined symbol _bar
Rafael Espindola9c8904f2015-11-18 06:11:0110// RUN: not ld.lld -o %t/r %t/m.o 2>&1 \
Igor Kudrin1309fc02015-09-28 15:01:5911// RUN: | FileCheck --check-prefix=UNDEFINED %s
George Rimar57610422016-03-11 14:43:0212// UNDEFINED: undefined symbol: _bar
Igor Kudrin1309fc02015-09-28 15:01:5913
14// We need to be sure that there is no suitable library in the /lib directory
Rafael Espindola9c8904f2015-11-18 06:11:0115// RUN: not ld.lld -o %t/r %t/m.o -L/lib -l:libls.a 2>&1 \
Igor Kudrin1309fc02015-09-28 15:01:5916// RUN: | FileCheck --check-prefix=NOLIB %s
George Rimar777f9632016-03-12 08:31:3417// NOLIB: unable to find library -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5918
19// Should just remove the '=' symbol if --sysroot is not specified.
20// Case 1: relative path
Rafael Espindola9c8904f2015-11-18 06:11:0121// RUN: cd %t && ld.lld -o %t/r %t/m.o -L=lib -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5922// Case 2: absolute path
Rafael Espindola9c8904f2015-11-18 06:11:0123// RUN: cd %p && ld.lld -o %t/r %t/m.o -L=%t/lib -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5924
25// RUN: cd %p
26
27// Should substitute SysRoot if specified
Rafael Espindola9c8904f2015-11-18 06:11:0128// RUN: ld.lld -o %t/r %t/m.o --sysroot=%t -L=lib -l:libls.a
29// RUN: ld.lld -o %t/r %t/m.o --sysroot=%t -L=/lib -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5930
31// Should not substitute SysRoot if the directory name does not start with '='
Rafael Espindola9c8904f2015-11-18 06:11:0132// RUN: not ld.lld -o %t/r %r/m.o --sysroot=%t -Llib -l:libls.a
33// RUN: not ld.lld -o %t/r %r/m.o --sysroot=%t -L/lib -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5934
Rui Ueyama144debc2016-04-27 02:58:2735.globl _start,_bar
Igor Kudrin1309fc02015-09-28 15:01:5936_start: