Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2010-2020 Free Software Foundation, Inc. |
569b05a5 JK |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
15 | ||
27c9e813 PA |
16 | if [skip_shlib_tests] { |
17 | return | |
18 | } | |
19 | ||
20 | # The testcase assumes the target can access the OBJDIR. | |
21 | if [is_remote target] { | |
22 | return | |
23 | } | |
24 | ||
25 | # We need to be able to influence the target's environment and working | |
26 | # directory. Can't do that if when we connect the inferior is already | |
27 | # running. | |
079670b9 | 28 | if [use_gdb_stub] { |
569b05a5 JK |
29 | return |
30 | } | |
31 | ||
32 | set testfile "solib-nodir" | |
33 | # Arbitrary file, possibly not containing main, even an empty one. | |
34 | set srclibfile foo.c | |
35 | # Arbitrary file containing main. | |
36 | set srcfile start.c | |
37 | set binlibfilebase ${testfile}.so | |
0ab77f5f | 38 | set binlibfiledir [standard_output_file {}] |
569b05a5 JK |
39 | set binlibfile ${binlibfiledir}/${binlibfilebase} |
40 | set executable ${testfile} | |
0ab77f5f TT |
41 | set objfile [standard_output_file ${executable}.o] |
42 | set binfile [standard_output_file ${executable}] | |
569b05a5 JK |
43 | |
44 | # build the first test case | |
4c93b1db | 45 | if { [get_compiler_info] |
d8b34041 | 46 | || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" [list debug ldflags=-Wl,-soname,${binlibfilebase}]] != "" |
569b05a5 JK |
47 | || [gdb_gnu_strip_debug $binlibfile] |
48 | || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" | |
49 | || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {}] != "" } { | |
5b362f04 | 50 | untested "failed to compile" |
569b05a5 JK |
51 | return -1 |
52 | } | |
53 | ||
54 | clean_restart $executable | |
d9019901 | 55 | gdb_load_shlib ${binlibfile} |
569b05a5 JK |
56 | |
57 | gdb_test_no_output "set env LD_LIBRARY_PATH=:" | |
27c9e813 PA |
58 | gdb_test_no_output "set cwd ${binlibfiledir}" \ |
59 | "set cwd OBJDIR/${subdir}" | |
569b05a5 JK |
60 | |
61 | set test "library loaded" | |
62 | if [runto_main] { | |
63 | pass $test | |
64 | } else { | |
65 | fail $test | |
66 | } |