1// 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 10// RUN: not ld.lld -o %t/r %t/m.o 2>&1 \ 11// RUN: | FileCheck --check-prefix=UNDEFINED %s 12// UNDEFINED: error: {{.*}}:(.text+0x1): undefined symbol '_bar' 13 14// We need to be sure that there is no suitable library in the /lib directory 15// RUN: not ld.lld -o %t/r %t/m.o -L/lib -l:libls.a 2>&1 \ 16// RUN: | FileCheck --check-prefix=NOLIB %s 17// NOLIB: unable to find library -l:libls.a 18 19// Should just remove the '=' symbol if --sysroot is not specified. 20// Case 1: relative path 21// RUN: cd %t && ld.lld -o %t/r %t/m.o -L=lib -l:libls.a 22// Case 2: absolute path 23// RUN: cd %p && ld.lld -o %t/r %t/m.o -L=%t/lib -l:libls.a 24 25// RUN: cd %p 26 27// Should substitute SysRoot if specified 28// 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 30 31// Should not substitute SysRoot if the directory name does not start with '=' 32// 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 34 35.globl _start,_bar 36_start: 37 call _bar 38