X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=ld%2Ftestsuite%2Fld-srec%2Fsrec.exp;h=21d165b724061985984b84b362cd1004b2c63034;hb=3b4412a0419d0faa42432df1e4faab880fe43b35;hp=7a52c895a8fc9b66505b08cb7fe5ba5ca2001c54;hpb=8c02e37df81fa71779c73be1dbc4ffecafcf1a82;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp index 7a52c895a8..21d165b724 100644 --- a/ld/testsuite/ld-srec/srec.exp +++ b/ld/testsuite/ld-srec/srec.exp @@ -1,6 +1,23 @@ # Test linking directly to S-records. # By Ian Lance Taylor, Cygnus Support. -# Public domain. +# Copyright (C) 1999-2016 Free Software Foundation, Inc. +# +# 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 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. # Get the offset from an S-record line to the start of the data. @@ -210,7 +227,10 @@ proc run_srec_test { test objs } { global sizeof_headers global host_triplet - set flags "" + # Tell the ELF linker to not do anything clever with .eh_frame, + # not to put anything in small data, and define various symbols. + set flags "--traditional-format -G 0 " + append flags [ld_simple_link_defsyms] # 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 @@ -221,49 +241,73 @@ proc run_srec_test { test objs } { set flags "$flags -Ttext 0x1000" } - # 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" + # ARM targets cannot convert format in the linker + # using the --oformat command line switch + if {[istarget aarch64*-*-*] || \ + [istarget arm*-*-*]} { + setup_xfail "aarch64-*-*" + setup_xfail "aarch64_be-*-*" + setup_xfail "arm*-*-*" } - # ARM targets call __gccmain - if [istarget arm-*-coff] { - set flags "$flags --defsym ___gccmain=0" + # The AVR target does not correctly process + # relocs when output format is not ELF. + if [istarget avr-*-*] { + setup_xfail "avr-*-*" } - if [istarget arm-*-pe] { - set flags "$flags --defsym ___gccmain=0" + + # Epiphany needs some help too + if [istarget epiphany*-*-*] { + set flags "$flags --defsym _start=00000060" + setup_xfail "epiphany*-*-*" } - # Thumb targets call __gccmain - if [istarget thumb-*-coff] { - set flags "$flags --defsym ___gccmain=0" + if [istarget m681*-*-*] { + set flags "$flags --defsym _start=0xc000" + setup_xfail "m681*-*-*" } - if [istarget thumb-*-pe] { - set flags "$flags --defsym ___gccmain=0" + + if [istarget m68hc1*-*-*] { + set flags "$flags --defsym _start=0xc000" + setup_xfail "m68hc1*-*-*" } - # PowerPC EABI code calls __eabi. - if [istarget powerpc*-*-eabi*] { - set flags "$flags --defsym __eabi=0" + if [istarget m9s12x*-*-*] { + set flags "$flags --defsym _start=0xc000" + setup_xfail "m9s12x*-*-*" } - # mn10200 code calls __truncsipsi2_d0_d2. - if {[istarget mn10200*-*-*]} then { - set flags "$flags --defsym __truncsipsi2_d0_d2=0" + # MSP430 targets always relax. + if [istarget msp430*-*-*] { + setup_xfail "msp430*-*-*" + } + + # SH64 targets cannot convert format in the linker + # using the -oformat command line switch. + if [istarget sh64*-*-elf] { + # This is what gcc passes to ld by default. + set flags "$flags -mshelf32" + setup_xfail "sh64*-*-*" + } + + # 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 "$flags $objs"] \ - || ![ld_simple_link $ld tmpdir/sr2.sr "$flags -oformat srec $objs"] } { - setup_xfail "hppa*-*-*elf*" + || ![ld_simple_link $ld tmpdir/sr2.sr "$flags --oformat srec $objs"] } { fail $test return } 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 [run_host_cmd "$objcopy" "-O srec tmpdir/sr1 tmpdir/sr1.sr"] set exec_output [prune_warnings $exec_output] if ![string match "" $exec_output] { send_log "$exec_output\n" @@ -287,7 +331,7 @@ set test1 "S-records" set test2 "S-records with constructors" # See whether the default linker script uses SIZEOF_HEADERS. -catch "exec $ld --verbose" exec_output +set exec_output [run_host_cmd "$ld" "--verbose"] set sizeof_headers [string match "*SIZEOF_HEADERS*" $exec_output] # First test linking a C program. We don't require any libraries. We @@ -295,16 +339,26 @@ set sizeof_headers [string match "*SIZEOF_HEADERS*" $exec_output] # directly to the S-record format, and require that the two files # contain the same data. -if { [which $CC] == 0 } { +if { ![is_remote host] && [which $CC] == 0 } { untested $test1 untested $test2 return } +# Pass -fplt to CC and CXX since -fno-plt doesn't work with S-records +# tests. +global PLT_CFLAGS +set old_CC "$CC" +set CC "$CC $PLT_CFLAGS" +set old_CXX "$CXX" +set CXX "$CXX $PLT_CFLAGS" + if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \ || ![ld_compile $CC $srcdir/$subdir/sr2.c tmpdir/sr2.o] } { unresolved $test1 unresolved $test2 + set CC "$old_CC" + set CXX "$old_CXX" return } @@ -315,17 +369,50 @@ 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*" +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 is not supported for ARC. +setup_xfail "arc-*-*" + # The S-record linker doesn't build ARM/Thumb stubs. -setup_xfail "thumb-*-coff*" +setup_xfail "arm-*-coff" +setup_xfail "arm-*-pe*" +# setup_xfail "arm-*elf*" +setup_xfail "arm*-*-linux*" + +# 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. +# Or MeP complex relocs. +setup_xfail "hppa*-*-*" "mep-*-*" -# The S-record linker doesn't build special EABI sections. -setup_xfail "powerpc*-*-eabi*" +# The S-record linker doesn't handle IA64 Elf relaxation. +setup_xfail "ia64-*-*" + +# 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*" +setup_xfail "score-*-*" + +# The S-record linker doesn't support Blackfin ELF FDPIC ABI. +setup_xfail "bfin-*-linux-uclibc" + +# On tile, we appear to be getting some random-seeming zeroing or 24-bit +# rightshifts (!) in the output when directly generating S-records from +# the linker. Not clear what could be causing this but we don't +# anticipate creating s-records (and could always use objcopy to +# generate the format if need be). +setup_xfail "tile*-*-*" run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o" @@ -333,21 +420,37 @@ run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o" # destructors. Note that since we are not linking against any # libraries, this program won't actually work or anything. -if { [which $CXX] == 0 } { +if { ![is_remote host] && [which $CXX] == 0 } { untested $test2 + set CC "$old_CC" + set CXX "$old_CXX" 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 + set CC "$old_CC" + set CXX "$old_CXX" return } # See above. setup_xfail "i*86-*-aout*" -setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" +setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*" setup_xfail "*-*-aix*" "*-*-xcoff*" -setup_xfail "thumb-*-coff*" -setup_xfail "powerpc*-*-eabi*" +setup_xfail "arc-*-*" +setup_xfail "arm*-*-*" +setup_xfail "v850*-*-elf" +setup_xfail "alpha*-*-elf*" "alpha*-*-linux-*" "alpha*-*-gnu*" +setup_xfail "alpha*-*-netbsd*" +setup_xfail "hppa*-*-*" "mep-*-*" +setup_xfail "ia64-*-*" +setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*" +setup_xfail "score-*-*" +setup_xfail "bfin-*-linux-uclibc" +setup_xfail "tile*-*-*" run_srec_test $test2 "tmpdir/sr3.o" + +set CC "$old_CC" +set CXX "$old_CXX"