From: Nick Clifton Date: Wed, 22 Jun 2016 13:42:26 +0000 (+0100) Subject: Fix various binutils testsuite failures. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=96037eb0;p=binutils-gdb.git Fix various binutils testsuite failures. * testsuite/binutils-all/ar.exp: Skip tests for Alpha target. Skip bfdtest1 tests for tic30 target. * testsuite/binutils-all/arm/objdump.exp: Skip for aout arm target. * testsuite/binutils-all/compress.exp: Expect some tests to fail on the nds32. * testsuite/binutils-all/copy-3.d: Skip for go32 targets. * testsuite/binutils-all/copy-4.d: Skip for AIX and linuxecoff targets. * testsuite/binutils-all/nm.exp: Treat beos based targets as ELF targets. * testsuite/binutils-all/objcopy.exp: Only run reverse bytes tests if the bintest.o file was created. Use the get_standard_section_names proc to get the name of the data section. * testsuite/binutils-all/objdump.exp: Update regexps to allow for RX section names. * testsuite/binutils-all/readelf.exp: Use get_standard_section_names proc to get the name of the data section. * testsuite/binutils-all/readelf.r: Allow for non standard text section names. * testsuite/binutils-all/readelf.s: Update regexps for tilepro. * testsuite/binutils-all/size.exp: Allow for non standard section names. * testsuite/binutils-all/update-section.exp: Expect comapre 1vs4 to fail on mips targets. * testsuite/lib/utils-lib.exp (default_binutils_run): Use get_standard_section_names proc. (run_dump_test): Likewise. (proc get_standard_section_names): New proc. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 941a358c19b..201b4668eb7 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,37 @@ +2016-06-22 Nick Clifton + + * testsuite/binutils-all/ar.exp: Skip tests for Alpha target. + Skip bfdtest1 tests for tic30 target. + * testsuite/binutils-all/arm/objdump.exp: Skip for aout arm + target. + * testsuite/binutils-all/compress.exp: Expect some tests to fail + on the nds32. + * testsuite/binutils-all/copy-3.d: Skip for go32 targets. + * testsuite/binutils-all/copy-4.d: Skip for AIX and linuxecoff + targets. + * testsuite/binutils-all/nm.exp: Treat beos based targets as ELF + targets. + * testsuite/binutils-all/objcopy.exp: Only run reverse bytes tests + if the bintest.o file was created. Use the + get_standard_section_names proc to get the name of the data + section. + * testsuite/binutils-all/objdump.exp: Update regexps to allow for + RX section names. + * testsuite/binutils-all/readelf.exp: Use + get_standard_section_names proc to get the name of the data + section. + * testsuite/binutils-all/readelf.r: Allow for non standard text + section names. + * testsuite/binutils-all/readelf.s: Update regexps for tilepro. + * testsuite/binutils-all/size.exp: Allow for non standard section + names. + * testsuite/binutils-all/update-section.exp: Expect comapre 1vs4 + to fail on mips targets. + * testsuite/lib/utils-lib.exp (default_binutils_run): Use + get_standard_section_names proc. + (run_dump_test): Likewise. + (proc get_standard_section_names): New proc. + 2016-06-22 Nick Clifton * readelf.c (dynamic_section_mips_val): Increase size of timebuf. diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp index 45be9b1b594..b8e0e20a1a5 100644 --- a/binutils/testsuite/binutils-all/ar.exp +++ b/binutils/testsuite/binutils-all/ar.exp @@ -26,6 +26,10 @@ if ![is_remote host] { } } +if {[istarget "alpha-*-*"]} then { + return +} + # send_user "Version [binutil_version $AR]" # Test long file name support @@ -600,7 +604,7 @@ proc empty_archive { } { # programs are built but not installed, running the testsuite on an # installed toolchain will produce ERRORs about missing bfdtest1 and # bfdtest2 executables. -if { [file exists $base_dir/bfdtest1] && [file exists $base_dir/bfdtest2] } { +if { ![istarget "tic30-*-*"] && [file exists $base_dir/bfdtest1] && [file exists $base_dir/bfdtest2] } { set bfdtests [list bfdtest1 bfdtest2] long_filenames $bfdtests diff --git a/binutils/testsuite/binutils-all/arm/objdump.exp b/binutils/testsuite/binutils-all/arm/objdump.exp index 1bdc23e5404..4b75701f7eb 100644 --- a/binutils/testsuite/binutils-all/arm/objdump.exp +++ b/binutils/testsuite/binutils-all/arm/objdump.exp @@ -18,6 +18,10 @@ if {![istarget "arm*-*-*"]} then { return } +if {[istarget "*-*-aout"]} then { + return +} + if {![is_remote host] && [which $OBJDUMP] == 0} then { perror "$OBJDUMP does not exist" return diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp index b35aba42444..65bf67d42f7 100644 --- a/binutils/testsuite/binutils-all/compress.exp +++ b/binutils/testsuite/binutils-all/compress.exp @@ -162,6 +162,7 @@ if ![string match "" $got] then { } } +setup_xfail "nds32*-*-*" set testname "objdump compress debug sections" set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "objdump.out"] if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { @@ -174,6 +175,7 @@ if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then { pass "$testname" } +setup_xfail "nds32*-*-*" set testname "objdump compress debug sections 3" set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "objdump.out"] if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { @@ -544,6 +546,7 @@ if ![string match "" $got] then { } } +setup_xfail "nds32*-*-*" set testname "objcopy compress debug sections in archive with zlib-gabi" set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${copyfile}gabi.a ${compressedcopyfile}gabi.a"] if ![string match "" $got] then { @@ -564,6 +567,7 @@ if ![string match "" $got] then { } } +setup_xfail "nds32*-*-*" set testname "objdump compress debug sections 3 with zlib-gabi" set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "objdump.out"] if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { diff --git a/binutils/testsuite/binutils-all/copy-3.d b/binutils/testsuite/binutils-all/copy-3.d index 655986af5e6..284aa56b459 100644 --- a/binutils/testsuite/binutils-all/copy-3.d +++ b/binutils/testsuite/binutils-all/copy-3.d @@ -3,7 +3,7 @@ #objcopy: --set-section-flags .text=alloc,data #name: copy with setting section flags 3 #source: bintest.s -#not-target: *-*-*aout *-*-*pe *-*-*coff hppa*-*-hpux* *-*-cygwin* *-*-mingw* m68k-*-netbsd m68k-*-openbsd* ns32k-*-netbsd rs6000-*-* +#not-target: *-*-*aout *-*-*coff *-*-cygwin* *-*-darwin *-*-mingw* *-*-go32 *-*-*pe hppa*-*-hpux* m68k-*-netbsd m68k-*-openbsd* ns32k-*-netbsd powerpc-*-aix* rs6000-*-* rx-*-* # The .text # section in PE/COFF has a fixed set of flags and these # cannot be changed. We skip it for them. diff --git a/binutils/testsuite/binutils-all/copy-4.d b/binutils/testsuite/binutils-all/copy-4.d index 41fccf00406..47a217c5d02 100644 --- a/binutils/testsuite/binutils-all/copy-4.d +++ b/binutils/testsuite/binutils-all/copy-4.d @@ -2,6 +2,7 @@ #source: bintest.s #strip: --strip-unneeded #nm: -n +#not-target: *-*-aix* *-*-linuxecoff #name: strip --strip-unneeded on common symbol #... diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp index 94f7f9cb058..69944ebe15e 100644 --- a/binutils/testsuite/binutils-all/nm.exp +++ b/binutils/testsuite/binutils-all/nm.exp @@ -163,6 +163,7 @@ if [regexp $want $got] then { # all the ELF variants, but adding the patterns here to that proc then # introduces a whole slew of new regressions in the GAS and LD testsuites. if { [is_elf_format] + || [istarget *-*-beos] || [istarget *-*-dragonfly*] || [istarget *-*-*elf] || [istarget *-*-freebsd*] diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index af333ac542b..94075f0f570 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -46,9 +46,10 @@ proc objcopy_test {testname srcfile} { global tempfile global copyfile - if {![binutils_assemble $srcdir/$subdir/${srcfile} tmpdir/bintest.o]} then { + if {![binutils_assemble $srcdir/$subdir/${srcfile} $tempfile]} then { perror "unresolved $testname" unresolved "objcopy ($testname)" + remote_file host delete $tempfile return } @@ -107,41 +108,48 @@ proc objcopy_test {testname srcfile} { objcopy_test "simple copy" bintest.s -# Test reversing bytes in a section. - -set reversed ${tempfile}-reversed -set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"] +if { [file exists $tempfile] } { + # Test reversing bytes in a section. -if ![string equal "" $got] then { - fail "objcopy --reverse-bytes" -} else { - if [is_remote host] { - remote_upload host ${reversed} tmpdir/copy-reversed.o - set reversed tmpdir/copy-reversed.o + set reversed ${tempfile}-reversed + set sect_names [get_standard_section_names] + if { $sect_names != "" } { + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j [lindex $sect_names 1] --reverse-bytes=4 $tempfile $reversed"] + } else { + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"] } - set origdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $tempfile"] - set revdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $reversed"] + if ![string equal "" $got] then { + fail "objcopy --reverse-bytes" + } else { + if [is_remote host] { + remote_upload host ${reversed} tmpdir/copy-reversed.o + set reversed tmpdir/copy-reversed.o + } + + set origdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $tempfile"] + set revdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $reversed"] - set want "^ \[0-9\]+ (\[0-9\]+)" - set found_orig [regexp -lineanchor $want $origdata -> origdata] - set found_rev [regexp -lineanchor $want $revdata -> revdata] + set want "^ \[0-9\]+ (\[0-9\]+)" + set found_orig [regexp -lineanchor $want $origdata -> origdata] + set found_rev [regexp -lineanchor $want $revdata -> revdata] - if {$found_orig == 0 || $found_rev == 0} then { - # som doesn't have a .data section - setup_xfail "hppa*-*-hpux*" - clear_xfail "hppa*64*-*-hpux*" + if {$found_orig == 0 || $found_rev == 0} then { + # som doesn't have a .data section + setup_xfail "hppa*-*-hpux*" + clear_xfail "hppa*64*-*-hpux*" - fail "objcopy --reverse-bytes" - } else { - scan $origdata "%2x%2x%2x%2x" b1 b2 b3 b4 - scan $revdata "%2x%2x%2x%2x" c4 c3 c2 c1 + fail "objcopy --reverse-bytes" + } else { + scan $origdata "%2x%2x%2x%2x" b1 b2 b3 b4 + scan $revdata "%2x%2x%2x%2x" c4 c3 c2 c1 - if {$b1 == $c1 && $b2 == $c2 && $b3 == $c3 && $b4 == $c4} then { - pass "objcopy --reverse-bytes" - } else { - fail "objcopy --reverse-bytes" - } + if {$b1 == $c1 && $b2 == $c2 && $b3 == $c3 && $b4 == $c4} then { + pass "objcopy --reverse-bytes" + } else { + fail "objcopy --reverse-bytes" + } + } } } @@ -184,66 +192,68 @@ if ![string equal "" $got] then { # Test generating S records. -# We make the srec filename 8.3 compatible. Note that the header string -# matched against depends on the name of the file. Ugh. - -if [is_remote host] { - set srecfile copy.sre - set header_string S00B0000636F70792E737265C1 -} else { - set srecfile ${copyfile}.srec - set header_string S0130000746D706469722F636F70792E7372656397 -} +if { [file exists $tempfile] } { + # We make the srec filename 8.3 compatible. Note that the header string + # matched against depends on the name of the file. Ugh. -set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"] - -if ![string equal "" $got] then { - fail "objcopy -O srec" -} else { if [is_remote host] { - remote_upload host ${srecfile} tmpdir/copy.srec - set srecfile tmpdir/copy.srec + set srecfile copy.sre + set header_string S00B0000636F70792E737265C1 + } else { + set srecfile ${copyfile}.srec + set header_string S0130000746D706469722F636F70792E7372656397 } - set file [open ${srecfile} r] - # The first S record is fixed by the file name we are using. - gets $file line - send_log "$line\n" - verbose $line - if ![regexp "$header_string.*" $line] { - send_log "bad header\n" + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"] + + if ![string equal "" $got] then { fail "objcopy -O srec" } else { - while {[gets $file line] != -1 \ - && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} { - send_log "$line\n" - verbose $line - set line "**EOF**" + if [is_remote host] { + remote_upload host ${srecfile} tmpdir/copy.srec + set srecfile tmpdir/copy.srec } + set file [open ${srecfile} r] + + # The first S record is fixed by the file name we are using. + gets $file line send_log "$line\n" verbose $line - if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then { - send_log "bad trailer\n" + if ![regexp "$header_string.*" $line] { + send_log "bad header\n" fail "objcopy -O srec" } else { - if {[gets $file line] != -1} then { - send_log "garbage at end\n" + while {[gets $file line] != -1 \ + && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} { send_log "$line\n" verbose $line + set line "**EOF**" + } + send_log "$line\n" + verbose $line + if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then { + send_log "bad trailer\n" fail "objcopy -O srec" } else { - set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"] - if ![regexp "file format srec" $got] then { - send_log "objdump failed\n" + if {[gets $file line] != -1} then { + send_log "garbage at end\n" + send_log "$line\n" + verbose $line fail "objcopy -O srec" } else { - pass "objcopy -O srec" + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"] + if ![regexp "file format srec" $got] then { + send_log "objdump failed\n" + fail "objcopy -O srec" + } else { + pass "objcopy -O srec" + } } } } - } - close $file + close $file + } } # Test setting and adjusting the start address. We only test this @@ -644,7 +654,7 @@ proc copy_executable { prog flags test1 test2 } { # This also fails for mips*-*-elf targets. See elf32-mips.c # mips_elf_sym_is_global. - setup_xfail "mips*-*-elf" + setup_xfail "mips*-*-elf" "tx39-*-*" setup_xfail "arm*-*-coff" setup_xfail "arm*-*-pe" diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index 3573037b270..f097a7e0719 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -86,7 +86,7 @@ if ![regexp $want $got] then { set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $testfile"] -set want "$testfile:\[ \]*file format.*Sections.*\[0-9\]+\[ \]+\[^ \]*(text|TEXT|\\\$CODE\\\$)\[^ \]*\[ \]*(\[0-9a-fA-F\]+).*\[0-9\]+\[ \]+\[^ \]*(\\.data|DATA)\[^ \]*\[ \]*(\[0-9a-fA-F\]+)" +set want "$testfile:\[ \]*file format.*Sections.*\[0-9\]+\[ \]+\[^ \]*(text|TEXT|P|\\\$CODE\\\$)\[^ \]*\[ \]*(\[0-9a-fA-F\]+).*\[0-9\]+\[ \]+\[^ \]*(\\.data|DATA|D_1)\[^ \]*\[ \]*(\[0-9a-fA-F\]+)" if ![regexp $want $got all text_name text_size data_name data_size] then { fail "objdump -h" @@ -136,7 +136,7 @@ if {![info exists vars(text_symbol)] \ set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $testfile"] -set want "$testfile:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|\\\$CODE\\\$)\[^\]\]*\\\].*external_symbol" +set want "$testfile:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|P|\\\$CODE\\\$)\[^\]\]*\\\].*external_symbol" if [regexp $want $got] then { pass "objdump -r" @@ -148,7 +148,7 @@ if [regexp $want $got] then { set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s $testfile"] -set want "$testfile:\[ \]*file format.*Contents.*(text|TEXT|\\\$CODE\\\$)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000|00000100).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000|00000200)" +set want "$testfile:\[ \]*file format.*Contents.*(text|TEXT|P|\\\$CODE\\\$)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000|00000100).*Contents.*(data|DATA|D_1)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000|00000200)" if [regexp $want $got] then { pass "objdump -s" @@ -265,6 +265,7 @@ if { ![is_elf_format] } then { send_log "\n" } + setup_xfail "msp430-*-*" "nds32*-*-*" if { [regexp_diff objdump.out $srcdir/$subdir/dw2-ranges.W] } then { fail "objdump -W for debug_ranges" } else { diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp index 500bf6b1bcf..91d816c36bc 100644 --- a/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -100,7 +100,7 @@ proc readelf_test { options binary_file regexp_file xfails } { set target_machine "" if [istarget "mips*-*-*"] then { - if { [istarget "mips*-*-*linux*"] + if { [istarget "mips*-*-*linux*"] || [istarget "mips*-sde-elf*"] || [istarget "mips*-mti-elf*"] || [istarget "mips*-img-elf*"] @@ -269,7 +269,12 @@ proc readelf_dump_test {} { set tempfile [remote_download host tmpdir/dumptest.o] # Run "readelf -p.data" on it. - set got [remote_exec host "$READELF $READELFFLAGS -p.data $tempfile" "" "/dev/null" "readelf.out"] + set sect_names [get_standard_section_names] + if { $sect_names != "" } { + set got [remote_exec host "$READELF $READELFFLAGS -p[lindex $sect_names 1] $tempfile" "" "/dev/null" "readelf.out"] + } else { + set got [remote_exec host "$READELF $READELFFLAGS -p.data $tempfile" "" "/dev/null" "readelf.out"] + } set got [lindex $got 1] # Upload the results. @@ -334,6 +339,7 @@ readelf_find_size $tempfile # Run the tests. readelf_test -h $tempfile readelf.h {} readelf_test -S $tempfile readelf.s {} +setup_xfail "mips-*-*irix*" readelf_test -s $tempfile readelf.ss {} readelf_test -r $tempfile readelf.r {} diff --git a/binutils/testsuite/binutils-all/readelf.r b/binutils/testsuite/binutils-all/readelf.r index 065fccf50ac..db23dcd842d 100644 --- a/binutils/testsuite/binutils-all/readelf.r +++ b/binutils/testsuite/binutils-all/readelf.r @@ -1,5 +1,5 @@ -Relocation section '.rel.*text' at offset 0x.* contains . entries: +Relocation section '.rel.*' at offset 0x.* contains . entries: Offset Info Type Sym.Value Sym. Name.* # NDS32 targets puts R_NDS32_RELAX_ENT here #... diff --git a/binutils/testsuite/binutils-all/readelf.s b/binutils/testsuite/binutils-all/readelf.s index 22b38435b5f..fd62fdab649 100644 --- a/binutils/testsuite/binutils-all/readelf.s +++ b/binutils/testsuite/binutils-all/readelf.s @@ -5,12 +5,12 @@ Section Headers: +\[ 0\] +NULL +00000000 000000 000000 00 +0 +0 +0 # On the normal MIPS systems, sections must be aligned to 16 byte # boundaries. On IA64, text sections are aligned to 16 byte boundaries. - +\[ 1\] .text +PROGBITS +00000000 0000(34|40) 0000(08|10) 00 +AX +0 +0 +(.|..) - +\[ 2\] .rel.+text +REL. +0+ 0+.* 0000.. 0. +I +.+ +1 +4 + +\[ 1\] .* +PROGBITS +00000000 0000(34|38|40) 0000(08|10) 00 +AX +0 +0 +(.|..) + +\[ 2\] .rel.* +REL. +0+ 0+.* 0000.. 0. +I +.+ +1 +4 # MIPS targets put .rela.text here. #... - +\[ .\] .data +PROGBITS +00000000 0000(3c|48|50) 0000(04|10) 00 +WA +0 +0 +(.|..) - +\[ .\] .bss +NOBITS +00000000 0000(40|4c|60) 000000 00 +WA +0 +0 +(.|..) + +\[ .\] .* +PROGBITS +00000000 0000(3c|40|48|50) 0000(04|10) 00 +WA +0 +0 +(.|..) + +\[ .\] .* +NOBITS +00000000 0000(40|44|4c|60) 000000 00 +WA +0 +0 +(.|..) # MIPS targets put .reginfo, .mdebug, .MIPS.abiflags and .gnu.attributes here. # v850 targets put .call_table_data and .call_table_text here. #... diff --git a/binutils/testsuite/binutils-all/size.exp b/binutils/testsuite/binutils-all/size.exp index fb2539336df..54484a2bed9 100644 --- a/binutils/testsuite/binutils-all/size.exp +++ b/binutils/testsuite/binutils-all/size.exp @@ -66,7 +66,7 @@ if ![regexp $want $got all text data bss dtot hextot] then { set got [binutils_run $SIZE "$SIZEFLAGS -A ${testfile}"] -set want "${testfile}.*(text|TEXT)\[^\n\r\]*\[ \]($dec)\[ \]+$dec.*(\\.data|DATA)\[^\n\r\]*\[ \]($dec)\[ \]+$dec" +set want "${testfile}.*(text|TEXT|P)\[^\n\r\]*\[ \]($dec)\[ \]+$dec.*(\\.data|DATA|D_1)\[^\n\r\]*\[ \]($dec)\[ \]+$dec" if ![regexp $want $got all textname textsize dataname datasize] then { fail "size -A" diff --git a/binutils/testsuite/binutils-all/update-section.exp b/binutils/testsuite/binutils-all/update-section.exp index 01fe713c8ab..74772fa6aaa 100644 --- a/binutils/testsuite/binutils-all/update-section.exp +++ b/binutils/testsuite/binutils-all/update-section.exp @@ -99,6 +99,7 @@ if { ![do_objcopy update-1.o \ # Check that the updated object files are as expected. do_compare update-1.o update-2.o do_compare update-1.o update-3.o +setup_xfail "mips*-*-*" "tx39-*-*" do_compare update-1.o update-4.o # Check that --update-section on an unknown section will fail. diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp index 790708a9ba5..6d2de5daef0 100644 --- a/binutils/testsuite/lib/utils-lib.exp +++ b/binutils/testsuite/lib/utils-lib.exp @@ -66,6 +66,15 @@ proc default_binutils_run { prog progargs } { } } + # For objdump, automatically translate standard section + # names to the targets one, if they are different. + set sect_names [get_standard_section_names] + if { $sect_names != "" && [string match "*objdump" $prog] } { + regsub -- "-j \\.text" $progargs "-j [lindex $sect_names 0]" progargs + regsub -- "-j \\.data" $progargs "-j [lindex $sect_names 1]" progargs + regsub -- "-j \\.bss" $progargs "-j [lindex $sect_names 2]" progargs + } + send_log "$prog $progargs\n" verbose "$prog $progargs" @@ -487,6 +496,15 @@ proc run_dump_test { name {extra_options {}} } { return } + # For objdump, automatically translate standard section names to the targets one, + # if they are different. + set sect_names [get_standard_section_names] + if { $sect_names != "" && $dumpprogram == "objdump"} { + regsub -- "-j \\.text" $progopts1 "-j [lindex $sect_names 0]" progopts1 + regsub -- "-j \\.data" $progopts1 "-j [lindex $sect_names 1]" progopts1 + regsub -- "-j \\.bss" $progopts1 "-j [lindex $sect_names 2]" progopts1 + } + verbose "running $binary $progopts $progopts1" 3 set cmd "$binary $progopts $progopts1 ${copyfile}.o" @@ -563,3 +581,16 @@ proc verbose_eval { expr { level 1 } } { global verbose if $verbose>$level then { eval verbose "$expr" $level } } + +# Internal procedure: return the names of the standard sections +# +proc get_standard_section_names {} { + if [istarget "rx-*-*"] { + return { "P" "D_1" "B_1" } + } + if [istarget "alpha*-*-*vms*"] { + # Double quote: for TCL and for sh. + return { "\\\$CODE\\\$" "\\\$DATA\\\$" "\\\$BSS\\\$" } + } + return +}