2 ## For a relative pathname in INPUT() or GROUP(), the parent directory of
3 ## the current linker script has priority over current working directory and -L.
5 # RUN: rm -rf %t.dir && mkdir %t.dir && cd %t.dir
8 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o a.o
9 # RUN: echo '.globl b, cwd; b: cwd:' | llvm-mc -filetype=obj -triple=x86_64 - -o b.o
10 # RUN: echo '.globl b, dir; b: dir:' | llvm-mc -filetype=obj -triple=x86_64 - -o dir/b.o
11 # RUN: llvm-ar rc libb.a b.o
12 # RUN: llvm-ar rc dir/libb.a dir/b.o
14 ## A relative pathname is relative to the parent directory of the current linker script.
15 ## The directory has priority over current working directory and -L.
16 # RUN: echo 'INPUT(libb.a)' > dir/relative.lds
17 # RUN: ld.lld -L. a.o dir/relative.lds -o - | llvm-nm - | FileCheck --check-prefix=DIR %s
18 ## GROUP() uses the same search order.
19 # RUN: echo 'GROUP(libb.a)' > dir/relative1.lds
20 # RUN: ld.lld -L. a.o dir/relative1.lds -o - | llvm-nm - | FileCheck --check-prefix=DIR %s
24 ## -l does not use the special rule.
25 # RUN: echo 'INPUT(-lb)' > dir/cwd.lds
26 # RUN: ld.lld -L. a.o dir/cwd.lds -o - | llvm-nm - | FileCheck --check-prefix=CWD %s
27 # RUN: echo 'GROUP(-lb)' > dir/cwd1.lds
28 # RUN: ld.lld -L. a.o dir/cwd1.lds -o - | llvm-nm - | FileCheck --check-prefix=CWD %s
32 ## The rules does not apply to an absolute path.
33 # RUN: echo 'INPUT(/libb.a)' > dir/absolute.lds
34 # RUN: not ld.lld a.o dir/absolute.lds -o /dev/null
36 ## If the parent directory of the current linker script does not contain the file,
37 ## fall back to the current working directory.
38 # RUN: cp libb.a libc.a
39 # RUN: echo 'INPUT(libc.a)' > dir/fallback.lds
40 # RUN: ld.lld a.o dir/fallback.lds -o /dev/null