Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 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 |
Rafael Espindola | 9c8904f | 2015-11-18 06:11:01 | [diff] [blame] | 10 | // RUN: not ld.lld -o %t/r %t/m.o 2>&1 \ |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 11 | // RUN: | FileCheck --check-prefix=UNDEFINED %s |
George Rimar | 5761042 | 2016-03-11 14:43:02 | [diff] [blame] | 12 | // UNDEFINED: undefined symbol: _bar |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 13 | |
| 14 | // We need to be sure that there is no suitable library in the /lib directory |
Rafael Espindola | 9c8904f | 2015-11-18 06:11:01 | [diff] [blame] | 15 | // RUN: not ld.lld -o %t/r %t/m.o -L/lib -l:libls.a 2>&1 \ |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 16 | // RUN: | FileCheck --check-prefix=NOLIB %s |
George Rimar | 777f963 | 2016-03-12 08:31:34 | [diff] [blame] | 17 | // NOLIB: unable to find library -l:libls.a |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 18 | |
| 19 | // Should just remove the '=' symbol if --sysroot is not specified. |
| 20 | // Case 1: relative path |
Rafael Espindola | 9c8904f | 2015-11-18 06:11:01 | [diff] [blame] | 21 | // RUN: cd %t && ld.lld -o %t/r %t/m.o -L=lib -l:libls.a |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 22 | // Case 2: absolute path |
Rafael Espindola | 9c8904f | 2015-11-18 06:11:01 | [diff] [blame] | 23 | // RUN: cd %p && ld.lld -o %t/r %t/m.o -L=%t/lib -l:libls.a |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 24 | |
| 25 | // RUN: cd %p |
| 26 | |
| 27 | // Should substitute SysRoot if specified |
Rafael Espindola | 9c8904f | 2015-11-18 06:11:01 | [diff] [blame] | 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 |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 30 | |
| 31 | // Should not substitute SysRoot if the directory name does not start with '=' |
Rafael Espindola | 9c8904f | 2015-11-18 06:11:01 | [diff] [blame] | 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 |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 34 | |
Rui Ueyama | 144debc | 2016-04-27 02:58:27 | [diff] [blame^] | 35 | .globl _start,_bar |
Igor Kudrin | 1309fc0 | 2015-09-28 15:01:59 | [diff] [blame] | 36 | _start: |