1# Copyright 2010-2020 Free Software Foundation, Inc. 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 16if [skip_shlib_tests] { 17 return 18} 19 20# The testcase assumes the target can access the OBJDIR. 21if [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. 28if [use_gdb_stub] { 29 return 30} 31 32set testfile "solib-nodir" 33# Arbitrary file, possibly not containing main, even an empty one. 34set srclibfile foo.c 35# Arbitrary file containing main. 36set srcfile start.c 37set binlibfilebase ${testfile}.so 38set binlibfiledir [standard_output_file {}] 39set binlibfile ${binlibfiledir}/${binlibfilebase} 40set executable ${testfile} 41set objfile [standard_output_file ${executable}.o] 42set binfile [standard_output_file ${executable}] 43 44# build the first test case 45if { [get_compiler_info] 46 || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" [list debug ldflags=-Wl,-soname,${binlibfilebase}]] != "" 47 || [gdb_gnu_strip_debug $binlibfile] 48 || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" 49 || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {}] != "" } { 50 untested "failed to compile" 51 return -1 52} 53 54clean_restart $executable 55gdb_load_shlib ${binlibfile} 56 57gdb_test_no_output "set env LD_LIBRARY_PATH=:" 58gdb_test_no_output "set cwd ${binlibfiledir}" \ 59 "set cwd OBJDIR/${subdir}" 60 61set test "library loaded" 62if [runto_main] { 63 pass $test 64} else { 65 fail $test 66} 67