brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 5da483f Raw
76 lines · plain
1# REQUIRES: x862 3# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o4# RUN: echo ".global foo; foo:" | \5# RUN:   llvm-mc -filetype=obj -triple=x86_64 - -o %tfoo.o6# RUN: rm -rf %t.dir %t.cwd7# RUN: mkdir -p %t.dir8 9## Error if dependent libraries cannot be found.10# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s -DOBJ=%t.o --check-prefix MISSING11# MISSING:      error: [[OBJ]]: unable to find library from dependent library specifier: foo.a12# MISSING-NEXT: error: [[OBJ]]: unable to find library from dependent library specifier: bar13 14## Can ignore dependent libraries.15# RUN: not ld.lld %t.o -o /dev/null --no-dependent-libraries 2>&1 | FileCheck %s --check-prefix IGNORE16# IGNORE: error: undefined symbol: foo17 18## -r links preserve dependent libraries.19# RUN: ld.lld %t.o %t.o -r -o %t-r.o20# RUN: not ld.lld %t-r.o -o /dev/null 2>&1 | sort | FileCheck %s -DOBJ=%t-r.o --check-prefixes MINUSR21# MINUSR:      error: [[OBJ]]: unable to find library from dependent library specifier: bar22# MINUSR-NEXT: error: [[OBJ]]: unable to find library from dependent library specifier: foo.a23# MINUSR-NOT:  unable to find library from dependent library specifier24 25## Dependent libraries searched for symbols after libraries on the command line.26# RUN: mkdir -p %t.cwd27# RUN: cd %t.cwd28# RUN: llvm-ar rc %t.dir/foo.a %tfoo.o29# RUN: touch %t.dir/libbar.so30# RUN: cp %t.dir/foo.a %t.cwd/libcmdline.a31# RUN: ld.lld %t.o libcmdline.a -o /dev/null -L %t.dir --trace 2>&1 | \32# RUN:   FileCheck %s -DOBJ=%t.o -DSO=%t.dir --check-prefix CMDLINE \33# RUN:                --implicit-check-not=foo.a --implicit-check-not=libbar.so34# CMDLINE:      [[OBJ]]35# CMDLINE-NEXT: {{^libcmdline\.a}}36 37## LLD tries to resolve dependent library specifiers in the following order:38##   1) The name, prefixed with "lib" and suffixed with ".so" or ".a" in a39##      library search path. This means that a directive of "foo.a" could lead40##      to a library named "libfoo.a.a" being linked in.41##   2) The literal name in a library search path.42##   3) The literal name in the current working directory.43## When using library search paths for dependent libraries, LLD follows the same44## rules as for libraries specified on the command line.45# RUN: cp %t.dir/foo.a %t.cwd/foo.a46# RUN: cp %t.dir/foo.a %t.dir/libfoo.a.a47 48# RUN: ld.lld %t.o -o /dev/null -L %t.dir --trace 2>&1 | \49# RUN:   FileCheck %s -DOBJ=%t.o -DDIR=%t.dir --check-prefix=LIBA-DIR \50# RUN:                --implicit-check-not=foo.a --implicit-check-not=libbar.so51 52# LIBA-DIR:      [[OBJ]]53# LIBA-DIR-NEXT: [[DIR]]{{[\\/]}}libfoo.a.a54 55# RUN: rm %t.dir/libfoo.a.a56# RUN: ld.lld %t.o -o /dev/null -L %t.dir --trace 2>&1 | \57# RUN:   FileCheck %s -DOBJ=%t.o -DDIR=%t.dir --check-prefix=PLAIN-DIR \58# RUN:                --implicit-check-not=foo.a --implicit-check-not=libbar.so59 60# PLAIN-DIR:      [[OBJ]]61# PLAIN-DIR-NEXT: [[DIR]]{{[\\/]}}foo.a62 63# RUN: rm %t.dir/foo.a64# RUN: ld.lld %t.o -o /dev/null -L %t.dir --trace 2>&1 | \65# RUN:   FileCheck %s -DOBJ=%t.o -DDIR=%t.dir --check-prefix=CWD \66# RUN:                --implicit-check-not=foo.a --implicit-check-not=libbar.so67 68# CWD:      [[OBJ]]69# CWD-NEXT: {{^foo\.a}}70 71    call foo72.section ".deplibs","MS",@llvm_dependent_libraries,173    .asciz "foo.a"74    ## Show that an unneeded archive must be present but may not be linked in.75    .asciz "bar"76