ChangeLog rotatation and copyright year update
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / readelf.exp
index 52be1ee58e49303f99380c32128a56558fe0062e..1d0ea3b1d4103ec30cbf47d7aedd62961115071f 100644 (file)
@@ -1,15 +1,15 @@
-#   Copyright 1999, 2000, 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 1999-2015 Free Software Foundation, Inc.
 
 # 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.
@@ -83,7 +83,7 @@ proc readelf_test { options binary_file regexp_file xfails } {
     global readelf_size
     global srcdir
     global subdir
-    
+
     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"]
 
@@ -100,7 +100,11 @@ proc readelf_test { options binary_file regexp_file xfails } {
 
     set target_machine ""
     if [istarget "mips*-*-*"] then {
-       if { [istarget "mips*-*-*linux*"] || [istarget "mips*-sde-elf*"] } then {
+       if { [istarget "mips*-*-*linux*"]
+            || [istarget "mips*-sde-elf*"]
+            || [istarget "mips*-mti-elf*"]
+            || [istarget "mips*-img-elf*"]
+            || [istarget "mips*-*freebsd*"] } then {
            set target_machine tmips
        } else {
            set target_machine mips
@@ -143,7 +147,7 @@ proc readelf_wi_test {} {
     global READELFFLAGS
     global srcdir
     global subdir
-    
+
     # Compile the second test file.
     if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
        verbose "Unable to compile test file."
@@ -161,7 +165,7 @@ proc readelf_wi_test {} {
     set output [remote_upload host readelf.out]
 
     file_on_host delete $tempfile
-    
+
     # Strip any superflous warnings.
     set got [prune_readelf_wi_warnings [lindex $got 1]]
 
@@ -179,7 +183,7 @@ proc readelf_wi_test {} {
        untested "readelf -wi"
        return
     }
-    
+
     # Search for strings that should be in the output.
     set sought {
        ".*DW_TAG_compile_unit.*"
@@ -192,8 +196,11 @@ proc readelf_wi_test {} {
        ".*DW_AT_name.*(main|indirect string).*"
        ".*\(DW_OP_addr: 0\).*"
     }
-    
-    foreach looked_for $sought {       
+
+    # The MSP430 in LARGE mode does not generate a DW_OP_addr.
+    setup_xfail msp430*-*-*
+
+    foreach looked_for $sought {
        set lines [grep $output $looked_for]
        if ![llength $lines] then {
            fail "readelf -wi: missing: $looked_for"
@@ -203,11 +210,52 @@ proc readelf_wi_test {} {
     }
 
     file_on_host delete $output
-    
+
     # All done.
     pass "readelf -wi"
 }
 
+# This tests "readelf -wa", but on a file with a compressed
+# .debug_abbrev section.
+
+proc readelf_compressed_wa_test {} {
+    global READELF
+    global READELFFLAGS
+    global srcdir
+    global subdir
+
+    if { ![is_zlib_supported] } {
+       unsupported "readelf -wa (compressed)"
+       return
+    }
+
+    # Compile the compressed-debug-section test file.
+    if { [target_compile $srcdir/$subdir/dw2-compressed.S tmpdir/dw2-compressed.o object debug] != "" } {
+       verbose "Unable to compile test file."
+       untested "readelf -wa (compressed)"
+       return
+    }
+
+    # Download it.
+    set tempfile [remote_download host tmpdir/dw2-compressed.o]
+
+    # Run "readelf -wa" on it.
+    set got [remote_exec host "$READELF $READELFFLAGS -wa $tempfile" "" "/dev/null" "readelf.out"]
+
+    # Upload the results.
+    set output [remote_upload host readelf.out]
+
+    file_on_host delete $tempfile
+
+    if { [string compare [file_contents readelf.out] [file_contents $srcdir/$subdir/readelf.wa]] != 0 } then {
+       fail "readelf -wa (compressed)"
+       verbose "output is \n[file_contents readelf.out]" 2
+       verbose "expected is \n[file_contents $srcdir/$subdir/readelf.wa]" 2
+       return
+    }
+
+    pass "readelf -wa (compressed)"
+}
 
 # Test readelf's dumping abilities.
 
@@ -216,7 +264,7 @@ proc readelf_dump_test {} {
     global READELFFLAGS
     global srcdir
     global subdir
-    
+
     # Assemble the dump test file.
     if {![binutils_assemble $srcdir/$subdir/dumptest.s tmpdir/dumptest.o]} then {
       unresolved "readelf -p: failed to assemble dump test file"
@@ -244,8 +292,8 @@ proc readelf_dump_test {} {
     set sought {
        ".*test_string.*"
     }
-    
-    foreach looked_for $sought {       
+
+    foreach looked_for $sought {
        set lines [grep $output $looked_for]
        if ![llength $lines] then {
            fail "readelf -p: missing: $looked_for"
@@ -254,7 +302,7 @@ proc readelf_dump_test {} {
        }
     }
 
-    file_on_host delete $tempfile    
+    file_on_host delete $tempfile
     file_on_host delete $output
 
     # All done.
@@ -295,5 +343,21 @@ readelf_test -s $tempfile readelf.ss {}
 readelf_test -r $tempfile readelf.r  {}
 
 readelf_wi_test
+readelf_compressed_wa_test
 
 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"
+    return
+}
+
+if ![is_remote host] {
+    set tempfile tmpdir/version.o
+} else {
+    set tempfile [remote_download host tmpdir/version.o]
+}
+
+readelf_test -n $tempfile readelf.n  {}
This page took 0.02551 seconds and 4 git commands to generate.