45 lines · plain
1# REQUIRES: x862## For a relative pathname in INPUT() or GROUP(), the parent directory of3## the current linker script has priority over current working directory and -L.4 5# RUN: rm -rf %t.dir && mkdir %t.dir && cd %t.dir6 7# RUN: mkdir dir8# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o a.o9# RUN: echo '.globl b, cwd; b: cwd:' | llvm-mc -filetype=obj -triple=x86_64 - -o b.o10# RUN: echo '.globl b, dir; b: dir:' | llvm-mc -filetype=obj -triple=x86_64 - -o dir/b.o11# RUN: llvm-ar rc libb.a b.o12# RUN: llvm-ar rc dir/libb.a dir/b.o13 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.lds17# RUN: ld.lld -L. a.o dir/relative.lds -o - | llvm-nm - | FileCheck --check-prefix=DIR %s18## GROUP() uses the same search order.19# RUN: echo 'GROUP(libb.a)' > dir/relative1.lds20# RUN: ld.lld -L. a.o dir/relative1.lds -o - | llvm-nm - | FileCheck --check-prefix=DIR %s21 22# DIR: T dir23 24## -l does not use the special rule.25# RUN: echo 'INPUT(-lb)' > dir/cwd.lds26# RUN: ld.lld -L. a.o dir/cwd.lds -o - | llvm-nm - | FileCheck --check-prefix=CWD %s27# RUN: echo 'GROUP(-lb)' > dir/cwd1.lds28# RUN: ld.lld -L. a.o dir/cwd1.lds -o - | llvm-nm - | FileCheck --check-prefix=CWD %s29 30# CWD: T cwd31 32## The rules does not apply to an absolute path.33# RUN: echo 'INPUT(/libb.a)' > dir/absolute.lds34# RUN: not ld.lld a.o dir/absolute.lds35 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.a39# RUN: echo 'INPUT(libc.a)' > dir/fallback.lds40# RUN: ld.lld a.o dir/fallback.lds41 42.globl _start43_start:44 call b45