diff options
author | Ken Raeburn <raeburn@cygnus> | 1995-07-07 22:49:42 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@cygnus> | 1995-07-07 22:49:42 +0000 |
commit | 943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec (patch) | |
tree | b240b5f343d4689d462e4b642626afbefc87c9f0 /ld/testsuite | |
parent | c71a604ae102994ad081cb57be24586126048ba6 (diff) | |
download | gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.zip gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.tar.gz gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.tar.bz2 |
fsf address update, but not in COPYING files
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/config/default.exp | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-bootstrap/bootstrap.exp | 81 | ||||
-rw-r--r-- | ld/testsuite/ld-cdtest/cdtest.exp | 94 | ||||
-rw-r--r-- | ld/testsuite/ld-empic/empic.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-shared/shared.exp | 165 | ||||
-rw-r--r-- | ld/testsuite/ld-versados/versados.exp | 2 |
6 files changed, 267 insertions, 83 deletions
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp index 4558ebc..24c04b8 100644 --- a/ld/testsuite/config/default.exp +++ b/ld/testsuite/config/default.exp @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # # Written by Jeffrey Wheat (cassidy@cygnus.com) # @@ -30,6 +30,10 @@ if ![info exists nm] then { set nm [findfile $base_dir/../binutils/nm.new $base_dir/../binutils/nm.new [transform nm]] } +if ![info exists objdump] then { + set objdump [findfile $base_dir/../binutils/objdump] +} + if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} # load the utility procedures diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp new file mode 100644 index 0000000..c149744 --- /dev/null +++ b/ld/testsuite/ld-bootstrap/bootstrap.exp @@ -0,0 +1,81 @@ +# Expect script for LD Bootstrap Tests +# Copyright (C) 1993,1994,1995 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# Rewritten by Ian Lance Taylor (ian@cygnus.com) +# + +# Make sure that ld can bootstrap itself. + +# This test can only be run if ld generates native executables. +if ![isnative] { + return +} + +# Bootstrap ld. First link the object files together using -r, in +# order to test -r. Then link the result into an executable, ld1, to +# really test -r. Use ld1 to link a fresh ld, ld2. Use ld2 to link a +# new ld, ld3. ld2 and ld3 should be identical. + +foreach flags {"" "--static" "--traditional-format" "--no-keep-memory"} { + if {"$flags" != ""} { + set testname "bootstrap with $flags" + } else { + set testname "bootstrap" + } + + # This test can only be run if we have the ld build directory, + # since we need the object files. + if {$ld != "$objdir/ld.new"} { + untested $testname + continue + } + + if ![ld_relocate $ld tmpdir/ld-partial.o "$flags $OFILES"] { + fail $testname + continue + } + + if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY"] { + fail $testname + continue + } + + if ![ld_link tmpdir/ld1 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] { + fail $testname + continue + } + + if ![ld_link tmpdir/ld2 tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY"] { + fail $testname + continue + } + + send_log "cmp tmpdir/ld2 tmpdir/ld3\n" + verbose "cmp tmpdir/ld2 tmpdir/ld3" + catch "exec cmp tmpdir/ld2 tmpdir/ld3" exec_output + set exec_output [prune_system_crud $host_triplet $exec_output] + + if [string match "" $exec_output] then { + pass $testname + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + + fail $testname + } +} diff --git a/ld/testsuite/ld-cdtest/cdtest.exp b/ld/testsuite/ld-cdtest/cdtest.exp new file mode 100644 index 0000000..68be616 --- /dev/null +++ b/ld/testsuite/ld-cdtest/cdtest.exp @@ -0,0 +1,94 @@ +# Expect script for LD cdtest Tests +# Copyright (C) 1993,1994,1995 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# Rewritten by Ian Lance Taylor (ian@cygnus.com) +# + +# Make sure that constructors are handled correctly. + +set test1 "cdtest" +set test2 "cdtest with -Ur" + +# This test requires running the executable generated by ld. +if ![isnative] { + return +} + +if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o] + || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o] + || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } { + unresolved $test1 + unresolved $test2 + return +} + +if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { + fail $test1 +} else { + send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" + verbose "tmpdir/cdtest >tmpdir/cdtest.out" + catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail $test1 + } else { + send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n" + verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" + catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output + set exec_output [prune_system_crud $host_triplet $exec_output] + + if [string match "" $exec_output] then { + pass $test1 + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail $test1 + } + } +} + +if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { + fail $test2 +} else { + if ![ld_link $ld tmpdir/cdtest tmpdir/cdtest.o] { + fail $test2 + } else { + send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" + verbose "tmpdir/cdtest >tmpdir/cdtest.out" + catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail $test2 + } else { + send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n" + verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" + catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output + set exec_output [prune_system_crud $host_triplet $exec_output] + + if [string match "" $exec_output] then { + pass $test2 + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail $test2 + } + } + } +} diff --git a/ld/testsuite/ld-empic/empic.exp b/ld/testsuite/ld-empic/empic.exp index 9cc1b07..8d91182 100644 --- a/ld/testsuite/ld-empic/empic.exp +++ b/ld/testsuite/ld-empic/empic.exp @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # # Written by Ian Lance Taylor (ian@cygnus.com) # diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp index d836a2a..18bdaf9 100644 --- a/ld/testsuite/ld-shared/shared.exp +++ b/ld/testsuite/ld-shared/shared.exp @@ -1,5 +1,5 @@ # Expect script for ld-shared tests -# Copyright (C) 1994 Free Software Foundation +# Copyright (C) 1994,1995 Free Software Foundation # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # # Written by Ian Lance Taylor (ian@cygnus.com) # @@ -41,57 +41,55 @@ if { ![istarget i386-*-sysv4*] \ return } -# Compile the main program. -if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/main.c tmpdir/main.o] { - return -} +# The test procedure. +proc shared_test { progname testname main sh1 sh2 } { + global ld + global srcdir + global subdir + global exec_output + global host_triplet -# The shared library is composed of two files. First compile them -# without using -fpic. That should work on an ELF system, although it -# will be less efficient because the dynamic linker will need to do -# more relocation work. However, note that not using -fpic will cause -# some of the tests to return different results. -if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh1.c tmpdir/sh1.o] { - return -} -if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh2.c tmpdir/sh2.o] { - return -} + # Build the shared library. + if {![ld_simple_link $ld tmpdir/$progname.so "-shared tmpdir/$sh1 tmpdir/$sh2"]} { + fail "$testname" + return + } -# Build the shared library. -if ![ld_simple_link $ld tmpdir/shnonpic.so {-shared tmpdir/sh1.o tmpdir/sh2.o}] { - fail "shared (non PIC)" -} else { - # Link against the shared library. Use -rpath so that the dynamic - # linker can locate the shared library at runtime. - if ![ld_link $ld tmpdir/shnonpic {-rpath tmpdir tmpdir/main.o tmpdir/shnonpic.so}] { - fail "shared (non PIC)" - } else { - # Run the resulting program - send_log "tmpdir/shnonpic >tmpdir/shnonpic.out\n" - verbose "tmpdir/shnonpic >tmpdir/shnonpic.out" - catch "exec tmpdir/shnonpic >tmpdir/shnonpic.out" exec_output - if ![string match "" $exec_output] then { - send_log "$exec_output\n" - verbose "$exec_output" - fail "shared (non PIC)" - } else { - send_log "diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat\n" - verbose "diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat" - catch "exec diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat" exec_output - if [string match "" $exec_output] then { - pass "shared (non PIC)" - } else { - send_log "$exec_output\n" - verbose "$exec_output" - fail "shared (non PIC)" - } - } + # Link against the shared library. Use -rpath so that the + # dynamic linker can locate the shared library at runtime. + if ![ld_link $ld tmpdir/$progname "-rpath tmpdir tmpdir/$main tmpdir/$progname.so"] { + fail "$testname" + return + } + + # Run the resulting program + send_log "tmpdir/$progname >tmpdir/$progname.out\n" + verbose "tmpdir/$progname >tmpdir/$progname.out" + catch "exec tmpdir/$progname >tmpdir/$progname.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" + fail "$testname" + return + } + + send_log "diff tmpdir/$progname.out $srcdir$subdir/shared.dat\n" + verbose "diff tmpdir/$progname.out $srcdir$subdir/shared.dat" + catch "exec diff tmpdir/$progname.out $srcdir$subdir/shared.dat" exec_output + set exec_output [prune_system_crud $host_triplet $exec_output] + + if {![string match "" $exec_output]} then { + send_log "$exec_output\n" + verbose "$exec_output" + fail "$testname" + return } + + pass "$testname" } -# Now compile the code using -fpic. Unfortunately, the gcc argument -# is -fpic and the cc argument is -KPIC. We have to try both. +# Unfortunately, the gcc argument is -fpic and the cc argument is +# -KPIC. We have to try both. set picflag "-fpic" send_log "$CC $picflag\n" @@ -106,41 +104,48 @@ if { [string match "*illegal option*" $exec_output] \ } verbose "Using $picflag to compile PIC code" -if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh1.c tmpdir/sh1.o] { - return -} -if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh2.c tmpdir/sh2.o] { - return +# Compile the main program. +if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/main.c tmpdir/mainnp.o] { + unresolved "shared (non PIC)" + unresolved "shared" +} else { + # The shared library is composed of two files. First compile them + # without using -fpic. That should work on an ELF system, + # although it will be less efficient because the dynamic linker + # will need to do more relocation work. However, note that not + # using -fpic will cause some of the tests to return different + # results. + if { ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh1.c tmpdir/sh1np.o] + || ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh2.c tmpdir/sh2np.o] } { + unresolved "shared (non PIC)" + } else { + shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o + } + + # Now compile the code using -fpic. + + if { ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh1.c tmpdir/sh1p.o] + || ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh2.c tmpdir/sh2p.o] } { + unresolved "shared" + } else { + shared_test shp "shared" mainnp.o sh1p.o sh2p.o + } } -# Build the shared library. -if ![ld_simple_link $ld tmpdir/shpic.so {-shared tmpdir/sh1.o tmpdir/sh2.o}] { - fail "shared" +# Now do the same tests again, but this time compile main.c PIC. +if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/main.c tmpdir/mainp.o] { + unresolved "shared (PIC main, non PIC so)" + unresolved "shared (PIC main)" } else { - # Link against the shared library. Use -rpath so that the dynamic - # linker can locate the shared library at runtime. - if ![ld_link $ld tmpdir/shpic {-rpath tmpdir tmpdir/main.o tmpdir/shpic.so}] { - fail "shared" + if { [file exists tmpdir/sh1np.o ] && [ file exists tmpdir/sh2np.o ] } { + shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o + } else { + unresolved "shared (PIC main, non PIC so)" + } + + if { [file exists tmpdir/sh1p.o ] && [ file exists tmpdir/sh2p.o ] } { + shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o } else { - # Run the resulting program - send_log "tmpdir/shpic >tmpdir/shpic.out\n" - verbose "tmpdir/shpic >tmpdir/shpic.out" - catch "exec tmpdir/shpic >tmpdir/shpic.out" exec_output - if ![string match "" $exec_output] then { - send_log "$exec_output\n" - verbose "$exec_output" - fail "shared" - } else { - send_log "diff tmpdir/shpic.out $srcdir$subdir/shared.dat\n" - verbose "diff tmpdir/shpic.out $srcdir$subdir/shared.dat" - catch "exec diff tmpdir/shpic.out $srcdir$subdir/shared.dat" exec_output - if [string match "" $exec_output] then { - pass "shared" - } else { - send_log "$exec_output\n" - verbose "$exec_output" - fail "shared" - } - } + unresolved "shared (PIC main)" } } diff --git a/ld/testsuite/ld-versados/versados.exp b/ld/testsuite/ld-versados/versados.exp index 4b33c0a..46a465f 100644 --- a/ld/testsuite/ld-versados/versados.exp +++ b/ld/testsuite/ld-versados/versados.exp @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # # Written by Steve Chamberlain (sac@cygnus.com) # |