diff options
Diffstat (limited to 'binutils/testsuite/binutils-all')
-rw-r--r-- | binutils/testsuite/binutils-all/note-3-32.d | 18 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3-32.s | 57 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3-64.d | 18 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3-64.s | 57 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/note-3.32.s | 67 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objcopy.exp | 4 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.exp | 12 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/readelf.exp | 91 |
8 files changed, 267 insertions, 57 deletions
diff --git a/binutils/testsuite/binutils-all/note-3-32.d b/binutils/testsuite/binutils-all/note-3-32.d new file mode 100644 index 0000000..fa571b0 --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3-32.d @@ -0,0 +1,18 @@ +#PROG: objcopy +#readelf: --notes --wide +#objcopy: --merge-notes +#name: v2 gnu build attribute notes (32-bit) +#source: note-3-32.s + +#... +Displaying notes found in: .gnu.build.attributes +[ ]+Owner[ ]+Data size[ ]+Description +[ ]+GA\$<version>2p1[ ]+0x0000000.[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 \(file: note_1.s\) +[ ]+GA\$<tool>gcc 6.3.1 20161221[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<stack prot>off[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<PIC>PIC[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\!<short enum>false[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<ABI>0x[0-9a-f]+[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +#... diff --git a/binutils/testsuite/binutils-all/note-3-32.s b/binutils/testsuite/binutils-all/note-3-32.s new file mode 100644 index 0000000..4dbbebe --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3-32.s @@ -0,0 +1,57 @@ + .text + .org 0x100 + .global note_1.s +note_1.s: + .word 0 + + .pushsection .gnu.build.attributes, "", %note + .balign 4 + + .dc.l 8 + .dc.l 4 + .dc.l 0x100 + .asciz "GA$2p1" + .dc.l note_1.s + + .dc.l 23 + .dc.l 0 + .dc.l 0x100 + .asciz "GA$gcc 6.3.1 20161221" + .dc.b 0 + + .dc.l 10 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 + .dc.b 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 + .dc.b 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 + .dc.b 0, 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 + .dc.b 0, 0 + + .dc.l 5 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x21, 0x8, 0 + .dc.b 0, 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 + .popsection diff --git a/binutils/testsuite/binutils-all/note-3-64.d b/binutils/testsuite/binutils-all/note-3-64.d new file mode 100644 index 0000000..f048e8b --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3-64.d @@ -0,0 +1,18 @@ +#PROG: objcopy +#readelf: --notes --wide +#objcopy: --merge-notes +#name: v2 gnu build attribute notes (64-bit) +#source: note-3-64.s + +#... +Displaying notes found in: .gnu.build.attributes +[ ]+Owner[ ]+Data size[ ]+Description +[ ]+GA\$<version>2p1[ ]+0x0000000.[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 \(file: note_1.s\) +[ ]+GA\$<tool>gcc 6.3.1 20161221[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<stack prot>off[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<PIC>PIC[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\!<short enum>false[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +[ ]+GA\*<ABI>0x[0-9a-f]+[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 +#... diff --git a/binutils/testsuite/binutils-all/note-3-64.s b/binutils/testsuite/binutils-all/note-3-64.s new file mode 100644 index 0000000..42f3e48 --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3-64.s @@ -0,0 +1,57 @@ + .text + .org 0x100 + .global note_1.s +note_1.s: + .word 0 + + .pushsection .gnu.build.attributes, "", %note + .balign 4 + + .dc.l 8 + .dc.l 8 + .dc.l 0x100 + .asciz "GA$2p1" + .8byte note_1.s + + .dc.l 23 + .dc.l 0 + .dc.l 0x100 + .asciz "GA$gcc 6.3.1 20161221" + .dc.b 0 + + .dc.l 10 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 + .dc.b 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 + .dc.b 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 + .dc.b 0, 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 + .dc.b 0, 0 + + .dc.l 5 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x21, 0x8, 0 + .dc.b 0, 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 + .popsection diff --git a/binutils/testsuite/binutils-all/note-3.32.s b/binutils/testsuite/binutils-all/note-3.32.s new file mode 100644 index 0000000..84d8c89 --- /dev/null +++ b/binutils/testsuite/binutils-all/note-3.32.s @@ -0,0 +1,67 @@ + .text + .org 0x100 + .global note1.s +note1.s: + .word 0 + + .pushsection .gnu.build.attributes, "", %note + .balign 4 + + .dc.l 8 + .dc.l 8 + .dc.l 0x100 + .asciz "GA$2p1" + .quad note_1.s + + .dc.l 23 + .dc.l 0 + .dc.l 0x100 + .asciz "GA$gcc 6.3.1 20161221" + .dc.b 0 + + .dc.l 10 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 + .dc.b 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 + .dc.b 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 + .dc.b 0, 0, 0 + + .dc.l 6 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 + .dc.b 0, 0 + + .dc.l 5 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x21, 0x8, 0 + .dc.b 0, 0, 0 + + .dc.l 13 + .dc.l 0 + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 + + .pushsection .note.gnu.property, "a", %note + .balign 4 + .dc.l 4 + .dc.l 32 + .dc.l 0x5 + .asciz "GNU" + .dc.b 0, 0, 0, 0xc0, 0x4, 0, 0, 0 + .dc.b 0, 0x6, 0, 0, 0, 0, 0, 0 + .dc.b 0x1, 0, 0, 0xc0, 0x4, 0, 0, 0 + .dc.b 0, 0x6, 0, 0, 0, 0, 0, 0 diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 6d57837..ef62edf 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -842,7 +842,7 @@ proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 } } # Tests that in a debug only copy of a file the sections -# headers whoes types have been changed to NOBITS still +# headers whose types have been changed to NOBITS still # retain their sh_link fields. proc keep_debug_symbols_and_check_links { prog flags test } { @@ -1056,8 +1056,10 @@ if [is_elf_format] { run_dump_test "note-1" if [is_elf64 tmpdir/bintest.o] { run_dump_test "note-2-64" + run_dump_test "note-3-64" } else { run_dump_test "note-2-32" + run_dump_test "note-3-32" } } diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index d003869..83b9af6 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -75,18 +75,16 @@ if [is_remote host] { set testfile2 tmpdir/bintest2.o } +# $testarchive exists only if it is supported. +set testarchive tmpdir/bintest.a +remote_file host file delete $testarchive if { ![istarget "alpha-*-*"] || [is_elf_format] } then { - remote_file host file delete tmpdir/bintest.a set got [binutils_run $AR "rc tmpdir/bintest.a $testfile2"] if ![string match "" $got] then { fail "bintest.a" remote_file host delete tmpdir/bintest.a - } else { - if [is_remote host] { - set testarchive [remote_download host tmpdir/bintest.a] - } else { - set testarchive tmpdir/bintest.a - } + } elseif [is_remote host] { + set testarchive [remote_download host tmpdir/bintest.a] } remote_file host delete tmpdir/bintest2.o } diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp index 3cbc1d2..81d1809 100644 --- a/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -84,6 +84,8 @@ proc readelf_test { options binary_file regexp_file xfails } { global srcdir global subdir + set testname "readelf $options [file rootname [file tail $binary_file]]" + send_log "exec $READELF $READELFFLAGS $options $binary_file > readelf.out\n" set got [remote_exec host "$READELF $READELFFLAGS $options $binary_file" "" "/dev/null" "readelf.out"] @@ -92,7 +94,7 @@ proc readelf_test { options binary_file regexp_file xfails } { } if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { - fail "readelf $options (reason: unexpected output)" + fail "$testname (reason: unexpected output)" send_log $got send_log "\n" return @@ -116,12 +118,12 @@ proc readelf_test { options binary_file regexp_file xfails } { } if { [regexp_diff readelf.out $srcdir/$subdir/$regexp_file] } then { - fail "readelf $options" + fail $testname verbose "output is \n[file_contents readelf.out]" 2 return } - pass "readelf $options" + pass $testname } # Simple proc to skip certain expected warning messages. @@ -318,26 +320,28 @@ send_user "Version [binutil_version $READELF]" # Assemble the test file. if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { - perror "could not assemble test file" - unresolved "readelf - failed to assemble" - return -} - -if ![is_remote host] { - set tempfile tmpdir/bintest.o + unresolved "readelf -h bintest (failed to assemble)" + unresolved "readelf -S bintest (failed to assemble)" + unresolved "readelf -s bintest (failed to assemble)" + unresolved "readelf -r bintest (failed to assemble)" } else { - set tempfile [remote_download host tmpdir/bintest.o] -} -# First, determine the size, so specific output matchers can be used. -readelf_find_size $tempfile + if ![is_remote host] { + set tempfile tmpdir/bintest.o + } else { + set tempfile [remote_download host tmpdir/bintest.o] + } -# 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 {} + # First, determine the size, so specific output matchers can be used. + 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 {} +} readelf_wi_test readelf_compressed_wa_test @@ -346,9 +350,7 @@ readelf_dump_test # PR 13482 - Check for off-by-one errors when dumping .note sections. if {![binutils_assemble $srcdir/$subdir/version.s tmpdir/version.o]} then { - perror "could not assemble version note test file" - unresolved "readelf - failed to assemble" - fail "readelf -n" + unresolved "readelf -n version (failed to assemble)" } else { if ![is_remote host] { @@ -364,9 +366,7 @@ if {![binutils_assemble $srcdir/$subdir/version.s tmpdir/version.o]} then { # PR 18374 - Check that relocations against the .debug_loc section # do not prevent readelf from displaying all the location lists. if {![binutils_assemble $srcdir/$subdir/pr18374.s tmpdir/pr18374.o]} then { - perror "could not assemble PR18374 test file" - unresolved "readelf - failed to assemble" - fail "readelf --debug-dump=loc" + unresolved "readelf --debug-dump=loc pr18374 (failed to assemble)" } else { if ![is_remote host] { @@ -381,9 +381,7 @@ if {![binutils_assemble $srcdir/$subdir/pr18374.s tmpdir/pr18374.o]} then { # locview - Check dumping of location lists with location views. if {![binutils_assemble $srcdir/$subdir/locview-1.s tmpdir/locview-1.o]} then { - perror "could not assemble locview-1 test file" - unresolved "readelf - failed to assemble" - fail "readelf --debug-dump=loc" + unresolved "readelf --debug-dump=loc locview-1 (failed to assemble)" } else { if ![is_remote host] { @@ -395,9 +393,7 @@ if {![binutils_assemble $srcdir/$subdir/locview-1.s tmpdir/locview-1.o]} then { readelf_test --debug-dump=loc $tempfile readelf.locview-1 {} } if {![binutils_assemble $srcdir/$subdir/locview-2.s tmpdir/locview-2.o]} then { - perror "could not assemble locview-2 test file" - unresolved "readelf - failed to assemble" - fail "readelf --debug-dump=loc" + unresolved "readelf --debug-dump=loc locview-2 (failed to assemble)" } else { if ![is_remote host] { @@ -412,9 +408,7 @@ if {![binutils_assemble $srcdir/$subdir/locview-2.s tmpdir/locview-2.o]} then { # Check that decompressed dumps work. if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then { - perror "could not assemble decompress dump test file" - unresolved "readelf - failed to assemble" - fail "readelf -z" + unresolved "readelf --decompress --hex-dump .debug_loc z (failed to assemble)" } else { if ![is_remote host] { @@ -436,21 +430,20 @@ if ![istarget "riscv*-*-*"] then { } # Assemble the DWARF-5 test file. if {![binutils_assemble_flags $srcdir/$subdir/dw5.S tmpdir/dw5.o $hpux]} then { - perror "could not assemble dw5 test file" - unresolved "readelf - failed to assemble dw5" - return - } - - # Download it. - if ![is_remote host] { - set tempfile tmpdir/dw5.o + unresolved "readelf -wiaoRlL dw5 (failed to assemble)" } else { - set tempfile [remote_download host tmpdir/dw5.o] - } - # First, determine the size, so specific output matchers can be used. - readelf_find_size $tempfile + # Download it. + if ![is_remote host] { + set tempfile tmpdir/dw5.o + } else { + set tempfile [remote_download host tmpdir/dw5.o] + } + + # First, determine the size, so specific output matchers can be used. + readelf_find_size $tempfile - # Make sure that readelf can decode the contents. - readelf_test -wiaoRlL $tempfile dw5.W { nds32*-elf } + # Make sure that readelf can decode the contents. + readelf_test -wiaoRlL $tempfile dw5.W { nds32*-elf } + } } |