2 # UNSUPPORTED: system-windows
4 # RUN: rm -rf %t.dir && mkdir %t.dir
5 # RUN: rm -rf %t && split-file %s %t && cd %t
6 # RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
7 # RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o
8 # RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/libsearch-st.s -o xyz.o
9 # RUN: llvm-ar rc %t.dir/libb.a b.o
10 # RUN: llvm-ar rc %t.dir/libxyz.a xyz.o
12 # RUN: echo 'GROUP("a.o" libxyz.a -lxyz b.o )' > 1.t
13 # RUN: not ld.lld 1.t 2>&1 | FileCheck %s --check-prefix=NOLIB
14 # RUN: ld.lld 1.t -L%t.dir
15 # RUN: llvm-nm a.out | FileCheck %s
17 # RUN: echo 'GROUP( "a.o" b.o =libxyz.a )' > 2.t
18 # RUN: not ld.lld 2.t 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=libxyz.a
19 # RUN: ld.lld 2.t --sysroot=%t.dir
20 # RUN: llvm-nm a.out | FileCheck %s
22 # RUN: echo 'GROUP("%t.dir/3a.t")' > 3.t
23 # RUN: echo 'INCLUDE "%t.dir/3a.t"' > 3i.t
24 # RUN: echo 'GROUP(AS_NEEDED("a.o"))INPUT(/libb.a)' > %t.dir/3a.t
25 # RUN: ld.lld 3.t --sysroot=%t.dir
26 # RUN: llvm-nm a.out | FileCheck %s
27 # RUN: ld.lld 3i.t --sysroot=%t.dir
28 # RUN: llvm-nm a.out | FileCheck %s
30 # RUN: echo 'GROUP("%t.dir/4a.t")INPUT(/libb.a)' > 4.t
31 # RUN: echo 'GROUP(AS_NEEDED("a.o"))' > %t.dir/4a.t
32 # RUN: not ld.lld 4.t --sysroot=%t.dir 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=/libb.a
34 # RUN: echo 'INCLUDE "%t.dir/5a.t" INPUT(/libb.a)' > 5.t
35 # RUN: echo 'GROUP(a.o)' > %t.dir/5a.t
36 # RUN: not ld.lld 5.t --sysroot=%t.dir 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=/libb.a
40 # NOLIB: error: {{.*}}unable to find
42 # RUN: echo 'GROUP("a.o" /libxyz.a )' > a.t
43 # RUN: echo 'GROUP("%t/a.o" /libxyz.a )' > %t.dir/xyz.t
44 # RUN: not ld.lld a.t 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=/libxyz.a
45 # RUN: not ld.lld a.t --sysroot=%t.dir 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=/libxyz.a
47 ## Since %t.dir/%t does not exist, report an error, instead of falling back to %t
48 ## without the syroot prefix.
49 # RUN: not ld.lld %t.dir/xyz.t --sysroot=%t.dir 2>&1 | FileCheck %s --check-prefix=CANNOT_FIND_SYSROOT -DTMP=%t/a.o
51 # CANNOT_FIND_SYSROOT: error: {{.*}}xyz.t:1: cannot find [[TMP]] inside {{.*}}.dir
52 # CANNOT_FIND_SYSROOT-NEXT: >>> GROUP({{.*}}
54 # CANNOT_OPEN: error: cannot open [[FILE]]: {{.*}}