blob: e9d6862b7a325be0176a064188ed8820ad2a4f07 [file] [log] [blame]
Fangrui Songb6772b82018-06-26 22:20:041// REQUIRES: x86
Igor Kudrin1309fc02015-09-28 15:01:592// RUN: mkdir -p %t/lib
3// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t/m.o
4// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
5// RUN: %p/Inputs/libsearch-st.s -o %t/st.o
6// RUN: rm -f %t/lib/libls.a
7// RUN: llvm-ar rcs %t/lib/libls.a %t/st.o
Igor Kudrin1309fc02015-09-28 15:01:598
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
Rui Ueyamab8760202017-03-30 19:13:4712// UNDEFINED: error: undefined symbol: _bar
13// UNDEFINED: >>> referenced by {{.*}}:(.text+0x1)
Igor Kudrin1309fc02015-09-28 15:01:5914
15// We need to be sure that there is no suitable library in the /lib directory
Rafael Espindola9c8904f2015-11-18 06:11:0116// RUN: not ld.lld -o %t/r %t/m.o -L/lib -l:libls.a 2>&1 \
Igor Kudrin1309fc02015-09-28 15:01:5917// RUN: | FileCheck --check-prefix=NOLIB %s
George Rimar777f9632016-03-12 08:31:3418// NOLIB: unable to find library -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5919
20// Should just remove the '=' symbol if --sysroot is not specified.
21// Case 1: relative path
Rafael Espindola9c8904f2015-11-18 06:11:0122// RUN: cd %t && ld.lld -o %t/r %t/m.o -L=lib -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5923// Case 2: absolute path
Rafael Espindola9c8904f2015-11-18 06:11:0124// RUN: cd %p && ld.lld -o %t/r %t/m.o -L=%t/lib -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5925
26// RUN: cd %p
27
28// Should substitute SysRoot if specified
Rafael Espindola9c8904f2015-11-18 06:11:0129// RUN: ld.lld -o %t/r %t/m.o --sysroot=%t -L=lib -l:libls.a
30// RUN: ld.lld -o %t/r %t/m.o --sysroot=%t -L=/lib -l:libls.a
George Rimar4f37d572017-07-21 16:27:2631// Check alias.
32// RUN: ld.lld -o %t/r %t/m.o --sysroot %t -L=lib -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5933
34// Should not substitute SysRoot if the directory name does not start with '='
Rafael Espindola9c8904f2015-11-18 06:11:0135// RUN: not ld.lld -o %t/r %r/m.o --sysroot=%t -Llib -l:libls.a
36// RUN: not ld.lld -o %t/r %r/m.o --sysroot=%t -L/lib -l:libls.a
Igor Kudrin1309fc02015-09-28 15:01:5937
Rui Ueyama144debc2016-04-27 02:58:2738.globl _start,_bar
Igor Kudrin1309fc02015-09-28 15:01:5939_start:
Eugene Leviant89837592016-10-06 09:45:0440 call _bar