annotate lld/test/ELF/deplibs.s @ 192:d7606dcf6fce

Added tag llvm10 for changeset 0572611fdcc8
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 14 Dec 2020 18:01:34 +0900
parents 0572611fdcc8
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 # REQUIRES: x86
anatofuz
parents:
diff changeset
2
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
4 # RUN: echo ".global foo; foo:" | \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 - -o %tfoo.o
150
anatofuz
parents:
diff changeset
6 # RUN: rm -rf %t.dir %t.cwd
anatofuz
parents:
diff changeset
7 # RUN: mkdir -p %t.dir
anatofuz
parents:
diff changeset
8
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
9 ## Error if dependent libraries cannot be found.
150
anatofuz
parents:
diff changeset
10 # RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s -DOBJ=%t.o --check-prefix MISSING
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
11 # MISSING: error: [[OBJ]]: unable to find library from dependent library specifier: foo.a
150
anatofuz
parents:
diff changeset
12 # MISSING-NEXT: error: [[OBJ]]: unable to find library from dependent library specifier: bar
anatofuz
parents:
diff changeset
13
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
14 ## Can ignore dependent libraries.
150
anatofuz
parents:
diff changeset
15 # RUN: not ld.lld %t.o -o /dev/null --no-dependent-libraries 2>&1 | FileCheck %s --check-prefix IGNORE
anatofuz
parents:
diff changeset
16 # IGNORE: error: undefined symbol: foo
anatofuz
parents:
diff changeset
17
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
18 ## -r links preserve dependent libraries.
150
anatofuz
parents:
diff changeset
19 # RUN: ld.lld %t.o %t.o -r -o %t-r.o
anatofuz
parents:
diff changeset
20 # RUN: not ld.lld %t-r.o -o /dev/null 2>&1 | sort | FileCheck %s -DOBJ=%t-r.o --check-prefixes MINUSR
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
21 # MINUSR: error: [[OBJ]]: unable to find library from dependent library specifier: bar
150
anatofuz
parents:
diff changeset
22 # MINUSR-NEXT: error: [[OBJ]]: unable to find library from dependent library specifier: foo.a
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
23 # MINUSR-NOT: unable to find library from dependent library specifier
150
anatofuz
parents:
diff changeset
24
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
25 ## Dependent libraries searched for symbols after libraries on the command line.
150
anatofuz
parents:
diff changeset
26 # RUN: mkdir -p %t.cwd
anatofuz
parents:
diff changeset
27 # RUN: cd %t.cwd
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
28 # RUN: llvm-ar rc %t.dir/foo.a %tfoo.o
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
29 # RUN: touch %t.dir/libbar.so
150
anatofuz
parents:
diff changeset
30 # RUN: cp %t.dir/foo.a %t.cwd/libcmdline.a
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
31 # RUN: ld.lld %t.o libcmdline.a -o /dev/null -L %t.dir --trace 2>&1 | \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
32 # RUN: FileCheck %s -DOBJ=%t.o -DSO=%t.dir --check-prefix CMDLINE \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
33 # RUN: --implicit-check-not=foo.a --implicit-check-not=libbar.so
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
34 # CMDLINE: [[OBJ]]
150
anatofuz
parents:
diff changeset
35 # CMDLINE-NEXT: {{^libcmdline\.a}}
anatofuz
parents:
diff changeset
36
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
37 ## LLD tries to resolve dependent library specifiers in the following order:
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
38 ## 1) The literal name in the current working directory.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
39 ## 2) The literal name in a library search path.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
40 ## 3) The name, prefixed with "lib" and suffixed with ".so" or ".a" in a
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
41 ## library search path. This means that a directive of "foo.a" could lead
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
42 ## to a library named "libfoo.a.a" being linked in.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
43 ## When using library search paths for dependent libraries, LLD follows the same
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
44 ## rules as for libraries specified on the command line.
150
anatofuz
parents:
diff changeset
45 # RUN: cp %t.dir/foo.a %t.cwd/foo.a
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
46 # RUN: cp %t.dir/foo.a %t.dir/libfoo.a.a
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
47 # RUN: ld.lld %t.o -o /dev/null -L %t.dir --trace 2>&1 | \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
48 # RUN: FileCheck %s -DOBJ=%t.o -DDIR=%t.dir --check-prefix=CWD \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
49 # RUN: --implicit-check-not=foo.a --implicit-check-not=libbar.so
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
50
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
51 # CWD: [[OBJ]]
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
52 # CWD-NEXT: {{^foo\.a}}
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
53
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
54 # RUN: rm %t.cwd/foo.a
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
55 # RUN: ld.lld %t.o -o /dev/null -L %t.dir --trace 2>&1 | \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
56 # RUN: FileCheck %s -DOBJ=%t.o -DDIR=%t.dir --check-prefix=PLAIN-DIR \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
57 # RUN: --implicit-check-not=foo.a --implicit-check-not=libbar.so
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
58
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
59 # PLAIN-DIR: [[OBJ]]
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
60 # PLAIN-DIR-NEXT: [[DIR]]{{[\\/]}}foo.a
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
61
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
62 # RUN: rm %t.dir/foo.a
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
63 # RUN: ld.lld %t.o -o /dev/null -L %t.dir --trace 2>&1 | \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
64 # RUN: FileCheck %s -DOBJ=%t.o -DDIR=%t.dir --check-prefix=LIBA-DIR \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
65 # RUN: --implicit-check-not=foo.a --implicit-check-not=libbar.so
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
66
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
67 # LIBA-DIR: [[OBJ]]
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
68 # LIBA-DIR-NEXT: [[DIR]]{{[\\/]}}libfoo.a.a
150
anatofuz
parents:
diff changeset
69
anatofuz
parents:
diff changeset
70 call foo
anatofuz
parents:
diff changeset
71 .section ".deplibs","MS",@llvm_dependent_libraries,1
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
72 .asciz "foo.a"
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
73 ## Show that an unneeded archive must be present but may not be linked in.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
74 .asciz "bar"