X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=ld%2Ftestsuite%2Fld-scripts%2Fcrossref.exp;h=98178de0639e285090be1a268059b37293d5a93c;hb=dfc3ab44df77a8842c24ab2fc6ea2aa3ad880aed;hp=97e1d36427b7d6fb6d410878fbe4ef3bbc50ef4b;hpb=75be928bd2cbcc431c59bb3b9f20a7c002fc2022;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp index 97e1d36427..98178de063 100644 --- a/ld/testsuite/ld-scripts/crossref.exp +++ b/ld/testsuite/ld-scripts/crossref.exp @@ -1,28 +1,33 @@ # Test NOCROSSREFS in a linker script. # By Ian Lance Taylor, Cygnus Support. -# Copyright 2000, 2001, 2002, 2003, 2004 +# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2007 # Free Software Foundation, Inc. # -# This file is free software; you can redistribute it and/or modify +# This file is part of the GNU Binutils. +# +# This program 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 +# the Free Software Foundation; either version 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. set test1 "NOCROSSREFS 1" set test2 "NOCROSSREFS 2" +set test3 "NOCROSSREFS 3" -if { [which $CC] == 0 } { +if { ![is_remote host] && [which $CC] == 0 } { untested $test1 untested $test2 + untested $test3 return } @@ -33,6 +38,19 @@ if [istarget xtensa*-*-*] { set CFLAGS "$CFLAGS -mtext-section-literals" } +# If we have a compiler that doesn't use/reference dot-symbols, then +# calls to functions reference the .opd section function descriptor. +# This makes NOCROSSREFS rather useless on powerpc64. +if [istarget powerpc64*-*-*] { + set CFLAGS "$CFLAGS -mcall-aixdesc" +} + +# Prevent the use of the MeP's small data area which references a symbol +# called __sdabase which will not be defined by our test linker scripts. +if [istarget mep*-*-elf] { + set CFLAGS "-mtiny=0" +} + if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \ || ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } { unresolved $test1 @@ -42,13 +60,6 @@ if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \ set flags [big_or_little_endian] -# The a29k compiled code calls V_SPILL and V_FILL. Since we don't -# need to run this code, but we don't have definitions for those -# functions, we just define them out. -if [istarget a29k*-*-*] { - set flags "$flags --defsym V_SPILL=0 --defsym V_FILL=0" -} - if [istarget sh64*-*-elf] { # This is what gcc passes to ld by default. set flags "-mshelf32" @@ -57,9 +68,7 @@ if [istarget sh64*-*-elf] { # IA64 has both ordered and unordered sections in an input file. setup_xfail ia64-*-* -verbose -log "$ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" - -catch "exec $ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" exec_output +set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"] set exec_output [prune_warnings $exec_output] @@ -83,10 +92,7 @@ if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } { return } -verbose -log "$ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o" - -catch "exec $ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o" exec_output - +set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"] set exec_output [prune_warnings $exec_output] regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output @@ -101,3 +107,28 @@ if [string match "" $exec_output] then { fail $test2 } } + +# Check cross references for ld -r + +if { ![ld_compile $CC "$srcdir/$subdir/cross4.c" tmpdir/cross4.o] } { + unresolved $test3 + return +} + +if ![ld_relocate $ld tmpdir/cross3-partial.o "tmpdir/cross1.o tmpdir/cross4.o"] { + unresolved $test3 + return +} + +set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o"] + +set exec_output [prune_warnings $exec_output] + +regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output + +if [string match "" $exec_output] then { + pass $test3 +} else { + verbose -log "$exec_output" + fail $test3 +}