Remove a29k support.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-srec / srec.exp
index 9583d3f402865daa19e7bb350653390b87d001cb..74e76e6a97c76b7c461977380f704bade90ac7e0 100644 (file)
@@ -1,6 +1,21 @@
 # Test linking directly to S-records.
 # By Ian Lance Taylor, Cygnus Support.
-# Public domain.
+#   Copyright 1999, 2000, 2001, 2002, 2003
+#   Free Software Foundation, Inc.
+#
+# 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 
 # Get the offset from an S-record line to the start of the data.
 
@@ -210,19 +225,77 @@ proc run_srec_test { test objs } {
     global sizeof_headers
     global host_triplet
 
+    # Tell the ELF linker to not do anything clever with .eh_frame.
+    set flags "--traditional-format"
+
     # If the linker script uses SIZEOF_HEADERS, use a -Ttext argument
     # to force both the normal link and the S-record link to be put in
     # the same place.  We don't always use -Ttext because it interacts
     # poorly with a.out.
 
     if { $sizeof_headers } {
-       set targ "-Ttext 0x1000"
-    } else {
-       set targ ""
+       set flags "$flags -Ttext 0x1000"
+    }
+
+    if [istarget sh64*-*-elf] {
+        # This is what gcc passes to ld by default.
+        set flags "-mshelf32"
+        # SH64 targets cannot convert format in the linker 
+        # using the -oformat command line switch.
+       setup_xfail "sh64*-*-*"
+    }
+
+    if {[istarget arm*-*-*]       || \
+        [istarget strongarm*-*-*] || \
+        [istarget xscale*-*-*]    || \
+        [istarget thumb-*-*] } {
+    
+        # ARM targets call __gccmain
+        set flags "$flags --defsym __gccmain=0"
+
+        # ARM targets cannot convert format in the linker 
+        # using the --oformat command line switch
+       setup_xfail "*arm*-*-*"
+       setup_xfail "xscale-*-*"
+       setup_xfail "thumb-*-*"
+    }
+
+    # PowerPC EABI code calls __eabi.
+    if [istarget powerpc*-*-eabi*] {
+       set flags "$flags --defsym __eabi=0"
+    }
+
+    # mn10200 code calls __truncsipsi2_d0_d2.
+    if {[istarget mn10200*-*-*]} then {
+       set flags "$flags --defsym __truncsipsi2_d0_d2=0"
+    }
+
+    # m6811/m6812 code has references to soft registers.
+    if {[istarget m6811-*-*] || [istarget m6812-*-*]} {
+       set flags "$flags --defsym _.frame=0 --defsym _.d1=0 --defsym _.d2=0"
+       set flags "$flags --defsym _.d3=0 --defsym _.d4=0"
+       set flags "$flags --defsym _.tmp=0 --defsym _.xy=0 --defsym _.z=0"
+    }
+
+    # V850 targets need libgcc.a
+    if [istarget v850*-*-elf] {
+       set objs "$objs -L ../gcc -lgcc"
+    }
+
+    # Xtensa ELF targets relax by default; S-Record linker does not
+    if [istarget xtensa*-*-*] {
+       set flags "$flags -no-relax"
     }
 
-    if { ![ld_simple_link $ld tmpdir/sr1 "$targ $objs"] \
-        || ![ld_simple_link $ld tmpdir/sr2.sr "$targ -oformat srec $objs"] } {
+    # Some OpenBSD targets have ProPolice and reference __guard and
+    # __stack_smash_handler.
+    if [istarget *-*-openbsd*] {
+       set flags "$flags --defsym __guard=0"
+       set flags "$flags --defsym __stack_smash_handler=0"
+    }
+
+    if { ![ld_simple_link $ld tmpdir/sr1 "$flags $objs"] \
+        || ![ld_simple_link $ld tmpdir/sr2.sr "$flags --oformat srec $objs"] } {
        fail $test
        return
     }
@@ -230,7 +303,7 @@ proc run_srec_test { test objs } {
     send_log "$objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr\n"
     verbose "$objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr"
     catch "exec $objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr" exec_output
-    set exec_output [prune_system_crud $host_triplet $exec_output]
+    set exec_output [prune_warnings $exec_output]
     if ![string match "" $exec_output] {
        send_log "$exec_output\n"
        verbose "$exec_output"
@@ -276,12 +349,48 @@ if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
 
 # The i386-aout target is confused: the linker does not put the
 # sections where objdump finds them.  I don't know which is wrong.
-setup_xfail "i\[345\]86-*-aout*"
+setup_xfail "i*86-*-aout*"
+
+# These tests fail on the native MIPS ELF targets because the GP value
+# in the .reginfo section is not updated when the S-record version is
+# written out.  The mips-elf target itself does not use a .reginfo section.
+setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*"
+
+# The S-record linker doesn't do the magic TOC handling that XCOFF
+# linkers do.
+setup_xfail "*-*-aix*" "*-*-xcoff*"
+
+# The S-record linker doesn't build ARM/Thumb stubs.
+setup_xfail "arm-*-coff"
+setup_xfail "strongarm*-*-coff"
+setup_xfail "xscale*-*-coff"
+setup_xfail "arm-*-pe*"
+# setup_xfail "arm-*elf*"
+setup_xfail "thumb-*-coff*"
+setup_xfail "thumb-*-pe*"
+setup_xfail "thumb-*-elf*"
+setup_xfail "arm*-*-linux*"
+
+# The S-record linker doesn't build special EABI sections.
+# setup_xfail "powerpc*-*-eabi*"
+
+# The S-record linker doesn't include the .{zda} sections.
+setup_xfail "v850*-*-elf"
+
+# The S-record linker doesn't handle Alpha Elf relaxation.
+setup_xfail "alpha*-*-elf*" "alpha*-*-linux-*" "alpha*-*-gnu*"
+setup_xfail "alpha*-*-netbsd*"
+
+# The S-record linker hasn't any hope of coping with HPPA relocs.
+setup_xfail "hppa*-*-*"
+
+# The S-record linker doesn't handle IA64 Elf relaxation.
+setup_xfail "ia64-*-*"
 
-# These tests fail on the MIPS ELF target because the GP value in the
-# .reginfo section is not updated when the S-record version is written
-# out.
-setup_xfail "mips*-*-elf*" "mips*-*-irix\[56\]*"
+# The S-record linker doesn't support the special PE headers - the PE
+# emulation tries to write pe-specific information to the PE headers
+# in the output bfd, but it's not a PE bfd (it's an srec bfd)
+setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*"
 
 run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
 
@@ -294,20 +403,24 @@ if { [which $CXX] == 0 } {
     return
 }
 
-if ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/sr3.cc tmpdir/sr3.o] {
+if ![ld_compile "$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/sr3.cc tmpdir/sr3.o] {
     unresolved $test2
     return
 }
 
 # See above.
-setup_xfail "i\[345\]86-*-aout*"
-setup_xfail "mips*-*-elf*" "mips*-*-irix\[56\]*"
-
-# The i960 COFF targets fail this test because the i960 defaults to
-# little endian, while the srec target is big endian.  When the number
-# of entries in the constructor table is written out, the linker uses
-# the output BFD.  This seems correct, but it generates the wrong
-# result.  I don't know how to fix this.
-setup_xfail "i960*-*-coff*" "i960*-*-vxworks5.\[123456789\]*"
+setup_xfail "i*86-*-aout*"
+setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*"
+setup_xfail "*-*-aix*" "*-*-xcoff*"
+setup_xfail "arm*-*-*"
+setup_xfail "strongarm*-*-*"
+setup_xfail "thumb-*-*"
+setup_xfail "powerpc*-*-eabi*"
+setup_xfail "v850*-*-elf"
+setup_xfail "alpha*-*-elf*" "alpha*-*-linux-*" "alpha*-*-gnu*"
+setup_xfail "alpha*-*-netbsd*"
+setup_xfail "hppa*-*-*"
+setup_xfail "ia64-*-*"
+setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*"
 
 run_srec_test $test2 "tmpdir/sr3.o"
This page took 0.036725 seconds and 4 git commands to generate.