64 lines · plain
1# REQUIRES: x862# UNSUPPORTED: system-windows3 4# RUN: rm -rf %t.dir && mkdir %t.dir5# RUN: rm -rf %t && split-file %s %t && cd %t6# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o7# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o8# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/libsearch-st.s -o xyz.o9# RUN: llvm-ar rc %t.dir/libb.a b.o10# RUN: llvm-ar rc %t.dir/libxyz.a xyz.o11 12# RUN: echo 'GROUP("a.o" libxyz.a -lxyz b.o )' > 1.t13# RUN: not ld.lld 1.t 2>&1 | FileCheck %s --check-prefix=NOLIB14# RUN: ld.lld 1.t -L%t.dir15# RUN: llvm-nm a.out | FileCheck %s16 17# RUN: echo 'GROUP( "a.o" b.o =libxyz.a )' > 2.t18# RUN: not ld.lld 2.t 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=libxyz.a19# RUN: ld.lld 2.t --sysroot=%t.dir20# RUN: llvm-nm a.out | FileCheck %s21 22# RUN: echo 'GROUP("%t.dir/3a.t")' > 3.t23# RUN: echo 'INCLUDE "%t.dir/3a.t"' > 3i.t24# RUN: echo 'GROUP(AS_NEEDED("a.o"))INPUT(/libb.a)' > %t.dir/3a.t25# RUN: ld.lld 3.t --sysroot=%t.dir26# RUN: llvm-nm a.out | FileCheck %s27# RUN: ld.lld 3i.t --sysroot=%t.dir28# RUN: llvm-nm a.out | FileCheck %s29 30# RUN: echo 'GROUP("%t.dir/4a.t")INPUT(/libb.a)' > 4.t31# RUN: echo 'GROUP(AS_NEEDED("a.o"))' > %t.dir/4a.t32# RUN: not ld.lld 4.t --sysroot=%t.dir 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=/libb.a33 34# RUN: echo 'INCLUDE "%t.dir/5a.t" INPUT(/libb.a)' > 5.t35# RUN: echo 'GROUP(a.o)' > %t.dir/5a.t36# RUN: not ld.lld 5.t --sysroot=%t.dir 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=/libb.a37 38# CHECK: T _start39 40# NOLIB: error: {{.*}}unable to find41 42# RUN: echo 'GROUP("a.o" /libxyz.a )' > a.t43# RUN: echo 'GROUP("%t/a.o" /libxyz.a )' > %t.dir/xyz.t44# RUN: not ld.lld a.t 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=/libxyz.a45# RUN: not ld.lld a.t --sysroot=%t.dir 2>&1 | FileCheck %s --check-prefix=CANNOT_OPEN -DFILE=/libxyz.a46 47## Since %t.dir/%t does not exist, report an error, instead of falling back to %t48## 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.o50 51# CANNOT_FIND_SYSROOT: error: {{.*}}xyz.t:1: cannot find [[TMP]] inside {{.*}}.dir52# CANNOT_FIND_SYSROOT-NEXT: >>> GROUP({{.*}}53 54# CANNOT_OPEN: error: cannot open [[FILE]]: {{.*}}55 56#--- a.s57.globl _start58_start:59 call b60 61#--- b.s62.globl b63b:64