summaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/ChangeLog192
-rw-r--r--binutils/testsuite/binutils-all/arm/objdump.exp63
-rw-r--r--binutils/testsuite/binutils-all/arm/thumb2-cond.s6
-rw-r--r--binutils/testsuite/binutils-all/copy-1.d13
-rw-r--r--binutils/testsuite/binutils-all/copy-1.s6
-rw-r--r--binutils/testsuite/binutils-all/copy-2.d18
-rw-r--r--binutils/testsuite/binutils-all/copy-3.d17
-rw-r--r--binutils/testsuite/binutils-all/copytest.s7
-rw-r--r--binutils/testsuite/binutils-all/dlltool.exp7
-rw-r--r--binutils/testsuite/binutils-all/empty.s1
-rw-r--r--binutils/testsuite/binutils-all/localize-hidden-1.d19
-rw-r--r--binutils/testsuite/binutils-all/localize-hidden-1.s36
-rw-r--r--binutils/testsuite/binutils-all/localize-hidden-2.d7
-rw-r--r--binutils/testsuite/binutils-all/localize-hidden-2.s2
-rw-r--r--binutils/testsuite/binutils-all/needed-by-reloc.s7
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp99
-rw-r--r--binutils/testsuite/binutils-all/readelf.exp106
-rw-r--r--binutils/testsuite/binutils-all/strip-1.d11
-rw-r--r--binutils/testsuite/binutils-all/strip-2.d18
-rw-r--r--binutils/testsuite/binutils-all/strip-3.d11
-rw-r--r--binutils/testsuite/binutils-all/windres/MSG00001.binbin0 -> 112 bytes
-rw-r--r--binutils/testsuite/binutils-all/windres/dialogid.rsd8
-rw-r--r--binutils/testsuite/binutils-all/windres/html.rc7
-rw-r--r--binutils/testsuite/binutils-all/windres/html.rsd45
-rw-r--r--binutils/testsuite/binutils-all/windres/html1.hm11
-rw-r--r--binutils/testsuite/binutils-all/windres/html2.hm11
-rw-r--r--binutils/testsuite/binutils-all/windres/lang.rc1
-rw-r--r--binutils/testsuite/binutils-all/windres/messagetable.rc6
-rw-r--r--binutils/testsuite/binutils-all/windres/messagetable.rsd15
-rw-r--r--binutils/testsuite/binutils-all/windres/strtab1.rc1
-rw-r--r--binutils/testsuite/binutils-all/windres/strtab2.rc9
-rw-r--r--binutils/testsuite/binutils-all/windres/strtab2.rsd8
-rw-r--r--binutils/testsuite/binutils-all/windres/version.rc33
-rw-r--r--binutils/testsuite/binutils-all/windres/version.rsd55
-rw-r--r--binutils/testsuite/binutils-all/windres/version_cat.rc33
-rw-r--r--binutils/testsuite/binutils-all/windres/version_cat.rsd55
-rw-r--r--binutils/testsuite/binutils-all/windres/windres.exp7
-rw-r--r--binutils/testsuite/lib/utils-lib.exp503
38 files changed, 1330 insertions, 124 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index a7e6ad6d975ae..ee8d32ec7e0cb 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,195 @@
+2007-06-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * binutils-all/strip-3.d: Also strip .xtensa.info section.
+
+2007-05-24 Kai Tietz <Kai.Tietz@onevision.com>
+
+ * binutils-all/windres/version_cat.rc: New.
+ * binutils-all/windres/version_cat.rsd: New.
+
+2007-05-23 Kai Tietz <Kai.Tietz@onevision.com>
+
+ * binutils-all/windres/html.rc: New.
+ * binutils-all/windres/html.rsd: New.
+ * binutils-all/windres/html1.hm: New.
+ * binutils-all/windres/html2.hm: New.
+ * binutils-all/windres/messagetable.rc: New.
+ * binutils-all/windres/messagetable.rsd: New.
+ * binutils-all/windres/MSG00001.bin: New.
+ * binutils-all/windres/strtab2.rc: New.
+ * binutils-all/windres/strtab2.rsd: New.
+ * binutils-all/windres/version.rc: New.
+ * binutils-all/windres/version.rsd: New.
+ * binutils-all/windres/dialog.rsd: Fix expected results.
+
+2007-05-17 Joseph Myers <joseph@codesourcery.com>
+
+ * binutils-all/strip-3.d: Strip .pdr section.
+
+2007-05-15 Alan Modra <amodra@bigpond.net.au>
+
+ * binutils-all/objcopy.exp: Only run needed-by-reloc test for ELF.
+
+2007-05-11 Alan Modra <amodra@bigpond.net.au>
+
+ * binutils-all/needed-by-reloc.s: Use .long rather than .4byte.
+
+2007-05-08 Mark Shinwell <shinwell@codesourcery.com>
+
+ * binutils-all/strip-3.d: Strip .ARM.attributes and .reginfo
+ sections.
+
+2007-05-02 Alan Modra <amodra@bigpond.net.au>
+
+ * binutils-all/objcopy.exp (copy_setup): Don't perror, use send_log.
+ (copy_executable): Return early if test2 is blank.
+ Return unsupported rather than unresolved if we can't run
+ executables. Do test1 if we can compile.
+
+2007-04-24 Nathan Froyd <froydnj@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+
+ * binutils-all/objcopy.exp: Add test for stripping a symbol
+ used in a relocation.
+ * binutils-all/needed-by-reloc.s: New file.
+
+2007-04-20 Nathan Froyd <froydnj@codesourcery.com>
+ Phil Edwards <phil@codesourcery.com>
+ Thomas de Lellis <tdel@windriver.com>
+
+ * binutils-all/objcopy.exp: Add test for --reverse-bytes.
+
+2007-04-21 Richard Earnshaw <rearnsha@arm.com>
+
+ * binutils-all/readelf.exp (regexp_diff): Delete.
+
+2007-04-20 Richard Earnshaw <rearnsha@arm.com>
+
+ * binutils-all/arm/thumb2-cond.s: Allow for tab expansion by the pty.
+ Rename the second test.
+
+2007-04-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/4348
+ * binutils-all/empty.s: New file.
+ * binutils-all/strip-3.d: Likewise.
+
+ * binutils-all/objcopy.exp: Run strip-3 for ELF target.
+
+2007-02-27 Nathan Sidwell <nathan@codesourcery.com>
+
+ * binutils-all/objcopy.exp: Skip for uclinux targets.
+
+2007-02-14 Nick Clifton <nickc@redhat.com>
+
+ * binutils-all/readelf.exp (readelf_wi_test): Fix unexpected
+ output failure message.
+
+2007-01-08 Kai Tietz <kai.tietz@onevision.com>
+
+ * copy-3.d: Renamed target x86_64-*-mingw64 to x86_64-*-mingw*
+ * dlltool.exp: Dito
+ * lang.rc: Dito
+ * strtab1.rc: Dito
+ * windres.exp: Dito
+
+2006-09-20 Kai Tietz <Kai.Tietz@onevision.com>
+
+ * binutils-all/copy-3.d: Add support for target x86_64-pc-mingw64.
+ * binutils-all/dlltool.exp: Likewise.
+ * binutils-all/objcopy.exp: Likewise.
+ * binutils-all/windres/windres.exp: Likewise.
+ * binutils-all/windres/lang.rc: xfail it as long as there is no windows.h.
+ * binutils-all/windres/strtab1.rc: Likewise.
+ * lib/utils-lib.exp: Adjust executable prefix detection (as .exe).
+
+2006-09-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/3181
+ * binutils-all/objcopy.exp: Run strip-1 and strip-2 for ELF
+ targets.
+
+ * binutils-all/strip-1.d: New file.
+ * binutils-all/strip-2.d: Likewise.
+
+ * lib/utils-lib.exp (run_dump_test): Support strip.
+
+2006-08-15 Thiemo Seufer <ths@mips.com>
+ Nigel Stephens <nigel@mips.com>
+ David Ung <davidu@mips.com>
+
+ * binutils-all/readelf.exp (readelf_test): Handle mips*-sde-elf*.
+
+2006-06-24 Richard Sandiford <richard@codesourcery.com>
+
+ * binutils-all/localize-hidden-1.d: Use objdump --syms instead
+ of readelf.
+
+2006-06-23 Richard Sandiford <richard@codesourcery.com>
+
+ * binutils-all/localize-hidden-1.s,
+ * binutils-all/localize-hidden-1.d,
+ * binutils-all/localize-hidden-2.s,
+ * binutils-all/localize-hidden-2.d: New tests.
+ * binutils-all/objcopy.exp: Run them.
+
+2006-06-06 Paul Brook <paul@codesourcery.com>
+
+ * binutils-all/arm/objdump.exp: New file.
+ * binutils-all/arm/thumb2-cond.s: New test.
+
+2006-05-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * binutils-all/copy-3.d: Fix a typo.
+
+2006-05-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * binutils-all/copy-3.d: New.
+
+ * objcopy.exp: Run copy-3.
+
+2006-05-02 Dave Korn <dave.korn@artimi.com>
+
+ * binutils-all/copy-1.d (name): Correct spelling of 'setting'.
+ * binutils-all/copy-1.d (name): Likewise.
+
+2006-05-02 Nick Clifton <nickc@redhat.com>
+
+ * binutils-all/copy-2.d: Change the name of the section whose
+ flags are changed to "foo" so that the test will work with PE
+ based targets. Skip this test for AOUT based targeted.
+ * binutils-all/copytest.s: New file.
+
+2006-05-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ * binutils-all/objcopy.exp: Run "copy-1" for ELF only.
+
+2006-05-01 Ben Elliston <bje@au.ibm.com>
+
+ * binutils-all/objcopy.exp (objcopy_test_readelf): Remove stray ;
+
+2006-04-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2593
+ * binutils-all/copy-1.d: New file.
+ * binutils-all/copy-1.s: Likewise.
+ * binutils-all/copy-2.d: Likewise.
+
+ * binutils-all/objcopy.exp: Add run_dump_test "copy-1" and
+ run_dump_test "copy-2".
+
+ * lib/utils-lib.exp (run_dump_test): New.
+ (slurp_options): Likewise.
+ (regexp_diff): Likewise.
+ (file_contents): Likewise.
+ (verbose_eval): Likewise.
+
+2006-04-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/2467
+ * binutils-all/objcopy.exp (strip_test): Also test "strip -g"
+ on archive.
+
2006-04-10 H.J. Lu <hongjiu.lu@intel.com>
* lib/utils-lib.exp (default_binutils_run): Check exit status.
diff --git a/binutils/testsuite/binutils-all/arm/objdump.exp b/binutils/testsuite/binutils-all/arm/objdump.exp
new file mode 100644
index 0000000000000..4677a48585c23
--- /dev/null
+++ b/binutils/testsuite/binutils-all/arm/objdump.exp
@@ -0,0 +1,63 @@
+# Copyright 2004
+# 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 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.
+
+if {![istarget "arm*-*-*"]} then {
+ return
+}
+
+if {[which $OBJDUMP] == 0} then {
+ perror "$OBJDUMP does not exist"
+ return
+}
+
+send_user "Version [binutil_version $OBJDUMP]"
+
+###########################
+# Set up the test of movem.s
+###########################
+
+if {![binutils_assemble $srcdir/$subdir/thumb2-cond.s tmpdir/thumb2-cond.o]} then {
+ return
+}
+
+if [is_remote host] {
+ set objfile [remote_download host tmpdir/thumb2-cond.o]
+} else {
+ set objfile tmpdir/thumb2-cond.o
+}
+
+# Make sure that conditional instructions are correctly decoded.
+
+set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=6 $objfile"]
+
+set want "bcc.w\[ \t\]*e12.*bx\[ \t\]*lr"
+
+if [regexp $want $got] then {
+ pass "thumb2-cond test1"
+} else {
+ fail "thumb2-cond test1"
+}
+
+set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=10 $objfile"]
+
+set want "bx\[ \t\]*lr"
+
+if [regexp $want $got] then {
+ pass "thumb2-cond test2"
+} else {
+ fail "thumb2-cond test2"
+}
diff --git a/binutils/testsuite/binutils-all/arm/thumb2-cond.s b/binutils/testsuite/binutils-all/arm/thumb2-cond.s
new file mode 100644
index 0000000000000..95761e17a6760
--- /dev/null
+++ b/binutils/testsuite/binutils-all/arm/thumb2-cond.s
@@ -0,0 +1,6 @@
+.thumb
+foo:
+.short 0xf000, 0xf800
+.short 0xbf38
+.short 0xf000, 0xbf04
+bx lr
diff --git a/binutils/testsuite/binutils-all/copy-1.d b/binutils/testsuite/binutils-all/copy-1.d
new file mode 100644
index 0000000000000..f2b0d9e90df73
--- /dev/null
+++ b/binutils/testsuite/binutils-all/copy-1.d
@@ -0,0 +1,13 @@
+#PROG: objcopy
+#objdump: -h
+#objcopy: --set-section-flags .post_text_reserve=contents,alloc,load,readonly,code
+#name: copy with setting section flags 1
+
+.*: +file format .*
+
+Sections:
+Idx.*
+#...
+ [0-9]* .post_text_reserve.*
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+#...
diff --git a/binutils/testsuite/binutils-all/copy-1.s b/binutils/testsuite/binutils-all/copy-1.s
new file mode 100644
index 0000000000000..32864de76ed8f
--- /dev/null
+++ b/binutils/testsuite/binutils-all/copy-1.s
@@ -0,0 +1,6 @@
+ .globl text_symbol
+ .text
+text_symbol:
+ .long 1
+ .section .post_text_reserve,"w", %nobits
+ .space 160
diff --git a/binutils/testsuite/binutils-all/copy-2.d b/binutils/testsuite/binutils-all/copy-2.d
new file mode 100644
index 0000000000000..8a1ab593858f5
--- /dev/null
+++ b/binutils/testsuite/binutils-all/copy-2.d
@@ -0,0 +1,18 @@
+#PROG: objcopy
+#objdump: -h
+#objcopy: --set-section-flags foo=contents,alloc,load,code
+#name: copy with setting section flags 2
+#source: copytest.s
+#not-target: *-*-aout
+# Note - we use copytest.s and a section named "foo" rather
+# than .text because for some file formats (eg PE) the .text
+# section has a fixed set of flags and these cannot be changed.
+
+.*: +file format .*
+
+Sections:
+Idx.*
+#...
+ [0-9]* foo.*
+ CONTENTS, ALLOC, LOAD, CODE
+#...
diff --git a/binutils/testsuite/binutils-all/copy-3.d b/binutils/testsuite/binutils-all/copy-3.d
new file mode 100644
index 0000000000000..1b07817cd230c
--- /dev/null
+++ b/binutils/testsuite/binutils-all/copy-3.d
@@ -0,0 +1,17 @@
+#PROG: objcopy
+#objdump: -h
+#objcopy: --set-section-flags .text=alloc,data
+#name: copy with setting section flags 3
+#source: bintest.s
+#not-target: *-*-aout *-*-*pe *-*-*coff i*86-*-cygwin* i*86-*-mingw32* x86_64-*-mingw*
+# The .text # section in PE/COFF has a fixed set of flags and these
+# cannot be changed. We skip it for them.
+
+.*: +file format .*
+
+Sections:
+Idx.*
+#...
+ [0-9]* .text.*
+ CONTENTS, ALLOC, LOAD, RELOC, DATA
+#...
diff --git a/binutils/testsuite/binutils-all/copytest.s b/binutils/testsuite/binutils-all/copytest.s
new file mode 100644
index 0000000000000..33c13b881a6c5
--- /dev/null
+++ b/binutils/testsuite/binutils-all/copytest.s
@@ -0,0 +1,7 @@
+ .globl foo_symbol
+ .section foo
+foo_symbol:
+ .long 1
+ .section bar
+bar_symbol:
+ .long 2
diff --git a/binutils/testsuite/binutils-all/dlltool.exp b/binutils/testsuite/binutils-all/dlltool.exp
index 6ddfcfae9b0c1..af0145d48d1c5 100644
--- a/binutils/testsuite/binutils-all/dlltool.exp
+++ b/binutils/testsuite/binutils-all/dlltool.exp
@@ -1,4 +1,4 @@
-# Copyright 2002, 2004 Free Software Foundation, Inc.
+# Copyright 2002, 2004, 2006 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
@@ -14,13 +14,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
-if {![istarget "i*86-*-*"]} {
+if {![istarget "i*86-*-*"] && ![istarget "x86_64-*-mingw*"] } {
return
}
if {![istarget "i*86-*-*pe*"] \
&& ![istarget "i*86-*-cygwin*"] \
- && ![istarget "i*86-*-mingw32*"] } {
+ && ![istarget "i*86-*-mingw32*"] \
+ && ![istarget "x86_64-*-mingw*"] } {
set target_xfail "yes"
} else {
set target_xfail "no"
diff --git a/binutils/testsuite/binutils-all/empty.s b/binutils/testsuite/binutils-all/empty.s
new file mode 100644
index 0000000000000..8690c06ad8e3c
--- /dev/null
+++ b/binutils/testsuite/binutils-all/empty.s
@@ -0,0 +1 @@
+# An empty file.
diff --git a/binutils/testsuite/binutils-all/localize-hidden-1.d b/binutils/testsuite/binutils-all/localize-hidden-1.d
new file mode 100644
index 0000000000000..a5286ed1e8142
--- /dev/null
+++ b/binutils/testsuite/binutils-all/localize-hidden-1.d
@@ -0,0 +1,19 @@
+#PROG: objcopy
+#objdump: --syms
+#objcopy: --localize-hidden
+#name: --localize-hidden test 1
+#...
+0+1200 l .*\*ABS\* 0+ \.hidden Lhidden
+0+1300 l .*\*ABS\* 0+ \.internal Linternal
+0+1400 l .*\*ABS\* 0+ \.protected Lprotected
+0+1100 l .*\*ABS\* 0+ Ldefault
+#...
+0+2200 l .*\*ABS\* 0+ \.hidden Ghidden
+0+2300 l .*\*ABS\* 0+ \.internal Ginternal
+0+3200 l .*\*ABS\* 0+ \.hidden Whidden
+0+3300 l .*\*ABS\* 0+ \.internal Winternal
+0+2100 g .*\*ABS\* 0+ Gdefault
+0+2400 g .*\*ABS\* 0+ \.protected Gprotected
+0+3100 w.*\*ABS\* 0+ Wdefault
+0+3400 w.*\*ABS\* 0+ \.protected Wprotected
+#pass
diff --git a/binutils/testsuite/binutils-all/localize-hidden-1.s b/binutils/testsuite/binutils-all/localize-hidden-1.s
new file mode 100644
index 0000000000000..bdaa69d0c08b8
--- /dev/null
+++ b/binutils/testsuite/binutils-all/localize-hidden-1.s
@@ -0,0 +1,36 @@
+ .globl Gdefault
+ .globl Ghidden
+ .globl Ginternal
+ .globl Gprotected
+
+ .weak Wdefault
+ .weak Whidden
+ .weak Winternal
+ .weak Wprotected
+
+ .hidden Lhidden
+ .hidden Ghidden
+ .hidden Whidden
+
+ .internal Linternal
+ .internal Ginternal
+ .internal Winternal
+
+ .protected Lprotected
+ .protected Gprotected
+ .protected Wprotected
+
+ .equ Ldefault, 0x1100
+ .equ Lhidden, 0x1200
+ .equ Linternal, 0x1300
+ .equ Lprotected, 0x1400
+
+ .equ Gdefault, 0x2100
+ .equ Ghidden, 0x2200
+ .equ Ginternal, 0x2300
+ .equ Gprotected, 0x2400
+
+ .equ Wdefault, 0x3100
+ .equ Whidden, 0x3200
+ .equ Winternal, 0x3300
+ .equ Wprotected, 0x3400
diff --git a/binutils/testsuite/binutils-all/localize-hidden-2.d b/binutils/testsuite/binutils-all/localize-hidden-2.d
new file mode 100644
index 0000000000000..ed3807aefbcf6
--- /dev/null
+++ b/binutils/testsuite/binutils-all/localize-hidden-2.d
@@ -0,0 +1,7 @@
+#PROG: objcopy
+#nm: -n
+#objcopy: --localize-hidden
+#name: --localize-hidden test 2
+#...
+0+100 A G
+#pass
diff --git a/binutils/testsuite/binutils-all/localize-hidden-2.s b/binutils/testsuite/binutils-all/localize-hidden-2.s
new file mode 100644
index 0000000000000..d428c3aa47089
--- /dev/null
+++ b/binutils/testsuite/binutils-all/localize-hidden-2.s
@@ -0,0 +1,2 @@
+ .globl G
+ .equ G,0x100
diff --git a/binutils/testsuite/binutils-all/needed-by-reloc.s b/binutils/testsuite/binutils-all/needed-by-reloc.s
new file mode 100644
index 0000000000000..40ebdedfe90fd
--- /dev/null
+++ b/binutils/testsuite/binutils-all/needed-by-reloc.s
@@ -0,0 +1,7 @@
+ .globl foo
+
+ .data
+ .long foo
+ .text
+foo:
+ .long 1
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 23e537ea76ac7..72338df350bd9 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1,5 +1,5 @@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004
+# 2004, 2006, 2007
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -113,6 +113,40 @@ 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 ![string match "" $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]
+
+ if {$found_orig == 0 || $found_rev == 0} then {
+ 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"
+ }
+ }
+}
+
# Test generating S records.
# We make the srec filename 8.3 compatible. Note that the header string
@@ -359,6 +393,12 @@ proc strip_test { } {
return
}
+ set exec_output [binutils_run $STRIP "-g $archive"]
+ if ![string match "" $exec_output] {
+ fail $test
+ return
+ }
+
set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
if ![string match "" $exec_output] {
fail $test
@@ -437,7 +477,7 @@ strip_test_with_saving_a_symbol
# Build a final executable.
-if { [istarget *-*-cygwin] || [istarget *-*-mingw32] } {
+if { [istarget *-*-cygwin] || [istarget *-*-mingw*] } {
set test_prog "testprog.exe"
} else {
set test_prog "testprog"
@@ -452,6 +492,10 @@ proc copy_setup { } {
set res [build_wrapper testglue.o]
set flags { debug }
+ if { [istarget *-*-uclinux*] } {
+ return 1
+ }
+
if { $res != "" } {
lappend flags "additional_flags=[lindex $res 1]"
set add_libs "testglue.o"
@@ -472,7 +516,7 @@ proc copy_setup { } {
set status [lindex $result 0]
if { $status != "pass" } {
- perror "unresolved setup, status = $status"
+ send_log "cannot run executable, status = ${status}\n"
return 3
}
@@ -497,6 +541,9 @@ proc copy_executable { prog flags test1 test2 } {
if ![string match "" $exec_output] {
fail $test1
+ if [string match "" $test2] {
+ return
+ }
fail $test2
return
}
@@ -538,6 +585,10 @@ proc copy_executable { prog flags test1 test2 } {
fail $test1
}
+ if [string match "" $test2] {
+ return
+ }
+
set output [remote_load target tmpdir/copyprog]
set status [lindex $output 0]
if { $status != "pass" } {
@@ -649,10 +700,10 @@ switch [copy_setup] {
untested $test4
}
"3" {
- unresolved $test1
- unresolved $test2
- unresolved $test3
- unresolved $test4
+ copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" ""
+ unsupported $test2
+ unsupported $test3
+ unsupported $test4
}
"0" {
copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2"
@@ -677,7 +728,7 @@ proc objcopy_test_readelf {testname srcfile} {
catch "exec $OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o" exec_output
if ![string match "" $exec_output] then {
fail "objcopy ($testname)"
- return;
+ return
}
verbose -log "$READELF -a tmpdir/bintest.o > tmpdir/bintest.o.out"
@@ -717,4 +768,36 @@ if { ([istarget "ia64-*-elf*"]
if [is_elf_format] {
objcopy_test "ELF unknown section type" unknown.s
objcopy_test_readelf "ELF group" group.s
+ run_dump_test "copy-1"
+}
+
+run_dump_test "copy-2"
+run_dump_test "copy-3"
+
+if [is_elf_format] {
+ run_dump_test "strip-1"
+ run_dump_test "strip-2"
+ run_dump_test "strip-3"
+
+ if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } {
+ # Check to make sure we don't strip a symbol named in relocations.
+ set test "objcopy keeps symbols needed by relocs"
+
+ set srcfile $srcdir/$subdir/needed-by-reloc.s
+
+ if {![binutils_assemble $srcfile tmpdir/bintest.o]} then {
+ unresolved $test
+ } else {
+ set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-symbol=foo tmpdir/bintest.o ${copyfile}.o"]
+
+ if [regexp "not stripping symbol `foo' because it is named in a relocation" $got] {
+ pass $test
+ } else {
+ fail $test
+ }
+ }
+ }
+
+ run_dump_test "localize-hidden-1"
}
+run_dump_test "localize-hidden-2"
diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp
index 8815fee59241f..814ae7caa5654 100644
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -31,108 +31,6 @@ proc file_contents { filename } {
return $contents
}
-# regexp_diff, based on simple_diff taken from ld test suite
-# compares two files line-by-line
-# file1 contains strings, file2 contains regexps and #-comments
-# blank lines are ignored in either file
-# returns non-zero if differences exist
-#
-proc regexp_diff { file_1 file_2 } {
-
- set eof -1
- set end_1 0
- set end_2 0
- set differences 0
- set diff_pass 0
-
- if [file exists $file_1] then {
- set file_a [open $file_1 r]
- } else {
- warning "$file_1 doesn't exist"
- return 1
- }
-
- if [file exists $file_2] then {
- set file_b [open $file_2 r]
- } else {
- fail "$file_2 doesn't exist"
- close $file_a
- return 1
- }
-
- verbose " Regexp-diff'ing: $file_1 $file_2" 2
-
- while { 1 } {
- set line_a ""
- set line_b ""
- while { [string length $line_a] == 0 } {
- if { [gets $file_a line_a] == $eof } {
- set end_1 1
- break
- }
- }
- while { [string length $line_b] == 0 || [string match "#*" $line_b] } {
- if [ string match "#pass" $line_b ] {
- set end_2 1
- set diff_pass 1
- break
- } elseif [ string match "#..." $line_b ] {
- if { [gets $file_b line_b] == $eof } {
- set end_2 1
- break
- }
- verbose "looking for \"^$line_b$\"" 3
- while { ![regexp "^$line_b$" "$line_a"] } {
- verbose "skipping \"$line_a\"" 3
- if { [gets $file_a line_a] == $eof } {
- set end_1 1
- break
- }
- }
- break
- }
- if { [gets $file_b line_b] == $eof } {
- set end_2 1
- break
- }
- }
-
- if { $diff_pass } {
- break
- } elseif { $end_1 && $end_2 } {
- break
- } elseif { $end_1 } {
- send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n"
- verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3
- set differences 1
- break
- } elseif { $end_2 } {
- send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n"
- verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3
- set differences 1
- break
- } else {
- verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3
- if ![regexp "^$line_b$" "$line_a"] {
- send_log "regexp_diff match failure\n"
- send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n"
- set differences 1
- }
- }
- }
-
- if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } {
- send_log "$file_1 and $file_2 are different lengths\n"
- verbose "$file_1 and $file_2 are different lengths" 3
- set differences 1
- }
-
- close $file_a
- close $file_b
-
- return $differences
-}
-
# Find out the size by reading the output of the EI_CLASS field.
# Similar to the test for readelf -h, but we're just looking for the
# EI_CLASS line here.
@@ -193,7 +91,7 @@ proc readelf_test { options binary_file regexp_file xfails } {
set target_machine ""
if [istarget "mips*-*-*"] then {
- if { [istarget "mips*-*-*linux*"] } then {
+ if { [istarget "mips*-*-*linux*"] || [istarget "mips*-sde-elf*"] } then {
set target_machine tmips
} else {
set target_machine mips
@@ -260,7 +158,7 @@ proc readelf_wi_test {} {
set got [prune_readelf_wi_warnings $got]
if ![string match "" $got] then {
- fail "readelf $options (reason: unexpected output)"
+ fail "readelf $READELFFLAGS -wi (reason: unexpected output)"
send_log $got
send_log "\n"
return
diff --git a/binutils/testsuite/binutils-all/strip-1.d b/binutils/testsuite/binutils-all/strip-1.d
new file mode 100644
index 0000000000000..200983211ea9a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/strip-1.d
@@ -0,0 +1,11 @@
+#PROG: strip
+#source: group.s
+#readelf: -Sg --wide
+#name: strip with section group 1
+
+#...
+ \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AX[ \t]+.*
+#...
+ \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WA[ \t]+.*
+#...
+There are no section groups in this file.
diff --git a/binutils/testsuite/binutils-all/strip-2.d b/binutils/testsuite/binutils-all/strip-2.d
new file mode 100644
index 0000000000000..5c54b7ecb8248
--- /dev/null
+++ b/binutils/testsuite/binutils-all/strip-2.d
@@ -0,0 +1,18 @@
+#PROG: strip
+#source: group.s
+#strip: --strip-unneeded
+#readelf: -Sg --wide
+#name: strip with section group 2
+
+#...
+ \[[ 0-9]+\] foo_group[ \t]+GROUP[ \t]+.*
+#...
+ \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG[ \t]+.*
+#...
+ \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
+#...
+COMDAT group section \[[ 0-9]+\] `foo_group' \[foo_group\] contains 2 sections:
+ \[Index\] Name
+ \[[ 0-9]+\] .text.*
+ \[[ 0-9]+\] .data.*
+#pass
diff --git a/binutils/testsuite/binutils-all/strip-3.d b/binutils/testsuite/binutils-all/strip-3.d
new file mode 100644
index 0000000000000..d656697700175
--- /dev/null
+++ b/binutils/testsuite/binutils-all/strip-3.d
@@ -0,0 +1,11 @@
+#PROG: strip
+#source: empty.s
+#strip: -R .text -R .data -R .bss -R .ARM.attributes -R .reginfo -R .pdr -R .xtensa.info
+#readelf: -S --wide
+#name: strip empty file
+#target: *-*-linux*
+
+#...
+ \[[ 0]+\][ \t]+NULL[ \t]+.*
+ \[[ 1]+\] \.shstrtab.*[ \t]+STRTAB[ \t]+.*
+#pass
diff --git a/binutils/testsuite/binutils-all/windres/MSG00001.bin b/binutils/testsuite/binutils-all/windres/MSG00001.bin
new file mode 100644
index 0000000000000..0092b83415255
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/MSG00001.bin
Binary files differ
diff --git a/binutils/testsuite/binutils-all/windres/dialogid.rsd b/binutils/testsuite/binutils-all/windres/dialogid.rsd
index 1e6bb1885dc7a..6c655a1c1178f 100644
--- a/binutils/testsuite/binutils-all/windres/dialogid.rsd
+++ b/binutils/testsuite/binutils-all/windres/dialogid.rsd
@@ -9,10 +9,10 @@ Contents of section .data:
0040 0100ffff 00000000 00000000 00008880 ................
0050 02000000 0000c800 c8000000 00000000 ................
0060 00000000 00000000 4d000050 0b000b00 ........M..P....
- 0070 5300a200 ffff0000 63006c00 61007300 S.......c.l.a.s.
- 0080 73006e00 61006d00 65000000 ffff6c00 s.n.a.m.e.....l.
+ 0070 5300a200 ffffffff 43004c00 41005300 S.......C.L.A.S.
+ 0080 53004e00 41004d00 45000000 ffff6c00 S.N.A.M.E.....l.
0090 00000000 00000000 00000000 0e120050 ...............P
- 00a0 05000500 0a000a00 66000000 63006c00 ........f...c.l.
- 00b0 61007300 73006e00 61006d00 65000000 a.s.s.n.a.m.e...
+ 00a0 05000500 0a000a00 66000000 43004c00 ........f...C.L.
+ 00b0 41005300 53004e00 41004d00 45000000 A.S.S.N.A.M.E...
00c0 73007400 72006900 6e006700 69006400 s.t.r.i.n.g.i.d.
00d0 00000000 ....
diff --git a/binutils/testsuite/binutils-all/windres/html.rc b/binutils/testsuite/binutils-all/windres/html.rc
new file mode 100644
index 0000000000000..ead6a11829c2b
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/html.rc
@@ -0,0 +1,7 @@
+//#xfail x86_64-*-mingw*
+#include "windows.h"
+
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+
+129 HTML "html1.hm"
+130 HTML "html2.hm"
diff --git a/binutils/testsuite/binutils-all/windres/html.rsd b/binutils/testsuite/binutils-all/windres/html.rsd
new file mode 100644
index 0000000000000..c124a82b662f0
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/html.rsd
@@ -0,0 +1,45 @@
+
+html.res: file format binary
+
+Contents of section .data:
+ 0000 00000000 20000000 ffff0000 ffff0000 .... ...........
+ 0010 00000000 00000000 00000000 00000000 ................
+ 0020 0d010000 20000000 ffff1700 ffff8100 .... ...........
+ 0030 00000000 30100704 00000000 00000000 ....0...........
+ 0040 3c21444f 43545950 4520646f 63747970 <!DOCTYPE doctyp
+ 0050 65205055 424c4943 20222d2f 2f773363 e PUBLIC "-//w3c
+ 0060 2f2f6474 64206874 6d6c2034 2e302074 //dtd html 4.0 t
+ 0070 72616e73 6974696f 6e616c2f 2f656e22 ransitional//en"
+ 0080 3e0d0a3c 68746d6c 3e0d0a3c 68656164 >..<html>..<head
+ 0090 3e0d0a20 203c6d65 74612063 6f6e7465 >.. <meta conte
+ 00a0 6e743d22 74657874 2f68746d 6c3b2063 nt="text/html; c
+ 00b0 68617273 65743d69 736f2d38 3835392d harset=iso-8859-
+ 00c0 31222020 68747470 2d657175 69763d22 1" http-equiv="
+ 00d0 436f6e74 656e742d 54797065 223e0d0a Content-Type">..
+ 00e0 20203c74 69746c65 3e57696e 64726573 <title>Windres
+ 00f0 3c2f7469 746c653e 0d0a3c2f 68656164 </title>..</head
+ 0100 3e0d0a0d 0a3c626f 64793e0d 0a546869 >....<body>..Thi
+ 0110 73206973 20612074 65737420 70616765 s is a test page
+ 0120 20666f72 2077696e 64726573 2048544d for windres HTM
+ 0130 4c207265 736f7572 63652e0d 0a3c2f62 L resource...</b
+ 0140 6f64793e 0d0a3c2f 68746d6c 3e000000 ody>..</html>...
+ 0150 14010000 20000000 ffff1700 ffff8200 .... ...........
+ 0160 00000000 30100704 00000000 00000000 ....0...........
+ 0170 3c21444f 43545950 4520646f 63747970 <!DOCTYPE doctyp
+ 0180 65205055 424c4943 20222d2f 2f773363 e PUBLIC "-//w3c
+ 0190 2f2f6474 64206874 6d6c2034 2e302074 //dtd html 4.0 t
+ 01a0 72616e73 6974696f 6e616c2f 2f656e22 ransitional//en"
+ 01b0 3e0d0a3c 68746d6c 3e0d0a3c 68656164 >..<html>..<head
+ 01c0 3e0d0a20 203c6d65 74612063 6f6e7465 >.. <meta conte
+ 01d0 6e743d22 74657874 2f68746d 6c3b2063 nt="text/html; c
+ 01e0 68617273 65743d69 736f2d38 3835392d harset=iso-8859-
+ 01f0 31222020 68747470 2d657175 69763d22 1" http-equiv="
+ 0200 436f6e74 656e742d 54797065 223e0d0a Content-Type">..
+ 0210 20203c74 69746c65 3e57696e 64726573 <title>Windres
+ 0220 3c2f7469 746c653e 0d0a3c2f 68656164 </title>..</head
+ 0230 3e0d0a0d 0a3c626f 64793e0d 0a546869 >....<body>..Thi
+ 0240 73206973 20612073 65636f6e 64207465 s is a second te
+ 0250 73742070 61676520 666f7220 77696e64 st page for wind
+ 0260 72657320 48544d4c 20726573 6f757263 res HTML resourc
+ 0270 652e0d0a 3c2f626f 64793e0d 0a3c2f68 e...</body>..</h
+ 0280 746d6c3e tml>
diff --git a/binutils/testsuite/binutils-all/windres/html1.hm b/binutils/testsuite/binutils-all/windres/html1.hm
new file mode 100644
index 0000000000000..ffc5a1825cce4
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/html1.hm
@@ -0,0 +1,11 @@
+<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
+ <title>Windres</title>
+</head>
+
+<body>
+This is a test page for windres HTML resource.
+</body>
+</html> \ No newline at end of file
diff --git a/binutils/testsuite/binutils-all/windres/html2.hm b/binutils/testsuite/binutils-all/windres/html2.hm
new file mode 100644
index 0000000000000..2fb343bf52829
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/html2.hm
@@ -0,0 +1,11 @@
+<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
+ <title>Windres</title>
+</head>
+
+<body>
+This is a second test page for windres HTML resource.
+</body>
+</html> \ No newline at end of file
diff --git a/binutils/testsuite/binutils-all/windres/lang.rc b/binutils/testsuite/binutils-all/windres/lang.rc
index d894315568e47..11a4d06b948bf 100644
--- a/binutils/testsuite/binutils-all/windres/lang.rc
+++ b/binutils/testsuite/binutils-all/windres/lang.rc
@@ -1,3 +1,4 @@
+//#xfail x86_64-*-mingw*
#include "windows.h"
LANGUAGE 0, 0
diff --git a/binutils/testsuite/binutils-all/windres/messagetable.rc b/binutils/testsuite/binutils-all/windres/messagetable.rc
new file mode 100644
index 0000000000000..e10ee639db5be
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/messagetable.rc
@@ -0,0 +1,6 @@
+//#xfail x86_64-*-mingw*
+#include "windows.h"
+
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+
+888 MESSAGETABLE MSG00001.bin
diff --git a/binutils/testsuite/binutils-all/windres/messagetable.rsd b/binutils/testsuite/binutils-all/windres/messagetable.rsd
new file mode 100644
index 0000000000000..9d108a589324b
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/messagetable.rsd
@@ -0,0 +1,15 @@
+
+messagetable.res: file format binary
+
+Contents of section .data:
+ 0000 00000000 20000000 ffff0000 ffff0000 .... ...........
+ 0010 00000000 00000000 00000000 00000000 ................
+ 0020 70000000 20000000 ffff0b00 ffff7803 p... .........x.
+ 0030 00000000 30100704 00000000 00000000 ....0...........
+ 0040 01000000 00000000 05000000 10000000 ................
+ 0050 14000000 4e6f7469 63653a20 25310d0a ....Notice: %1..
+ 0060 00000000 0c000000 25310d0a 00000000 ........%1......
+ 0070 10000000 5761726e 3a202531 0d0a0000 ....Warn: %1....
+ 0080 10000000 4572726f 723a2025 310d0a00 ....Error: %1...
+ 0090 10000000 46617461 6c3a2025 310d0a00 ....Fatal: %1...
+ 00a0 10000000 25310d0a 25320d0a 00000000 ....%1..%2......
diff --git a/binutils/testsuite/binutils-all/windres/strtab1.rc b/binutils/testsuite/binutils-all/windres/strtab1.rc
index a1a246d8eb822..416d157f1cf81 100644
--- a/binutils/testsuite/binutils-all/windres/strtab1.rc
+++ b/binutils/testsuite/binutils-all/windres/strtab1.rc
@@ -1,3 +1,4 @@
+//#xfail x86_64-*-mingw*
#include "windows.h"
LANGUAGE 0, 0
diff --git a/binutils/testsuite/binutils-all/windres/strtab2.rc b/binutils/testsuite/binutils-all/windres/strtab2.rc
new file mode 100644
index 0000000000000..9322034946c91
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/strtab2.rc
@@ -0,0 +1,9 @@
+//#xfail x86_64-*-mingw*
+#include "windows.h"
+
+LANGUAGE 0, 0
+
+STRINGTABLE MOVEABLE PURE DISCARDABLE
+BEGIN
+ 1 L"hello, world"
+END
diff --git a/binutils/testsuite/binutils-all/windres/strtab2.rsd b/binutils/testsuite/binutils-all/windres/strtab2.rsd
new file mode 100644
index 0000000000000..4d610739352b2
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/strtab2.rsd
@@ -0,0 +1,8 @@
+ 0000 00000000 20000000 ffff0000 ffff0000 .... ...........
+ 0010 00000000 00000000 00000000 00000000 ................
+ 0020 38000000 20000000 ffff0600 ffff0100 8... ...........
+ 0030 00000000 30100000 00000000 00000000 ....0...........
+ 0040 00000c00 68006500 6c006c00 6f002c00 ....h.e.l.l.o.,.
+ 0050 20007700 6f007200 6c006400 00000000 .w.o.r.l.d.....
+ 0060 00000000 00000000 00000000 00000000 ................
+ 0070 00000000 00000000 ........
diff --git a/binutils/testsuite/binutils-all/windres/version.rc b/binutils/testsuite/binutils-all/windres/version.rc
new file mode 100644
index 0000000000000..5eea3353e0d29
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/version.rc
@@ -0,0 +1,33 @@
+//#xfail x86_64-*-mingw*
+#include "windows.h"
+
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040704e4"
+ BEGIN
+ VALUE L"CompanyName", L"binutil\x0073"
+ VALUE "FileDescription", "RC compiler."
+ VALUE "FileVersion", "1.0.0.1"
+ VALUE "InternalName", "windres.exe"
+ VALUE "LegalCopyright", "(c) FSF. All rights are reserved."
+ VALUE "OriginalFilename", "windres.exe"
+ VALUE "ProductName", "windows resource compiler"
+ VALUE "ProductVersion", "1.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x407, 1252
+ END
+END
diff --git a/binutils/testsuite/binutils-all/windres/version.rsd b/binutils/testsuite/binutils-all/windres/version.rsd
new file mode 100644
index 0000000000000..85dd5d35281f9
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/version.rsd
@@ -0,0 +1,55 @@
+
+version.res: file format binary
+
+Contents of section .data:
+ 0000 00000000 20000000 ffff0000 ffff0000 .... ...........
+ 0010 00000000 00000000 00000000 00000000 ................
+ 0020 ec020000 20000000 ffff1000 ffff0100 .... ...........
+ 0030 00000000 00000704 00000000 00000000 ................
+ 0040 ec023400 00005600 53005f00 56004500 ..4...V.S._.V.E.
+ 0050 52005300 49004f00 4e005f00 49004e00 R.S.I.O.N._.I.N.
+ 0060 46004f00 00000000 bd04effe 00000100 F.O.............
+ 0070 00000100 01000000 00000100 01000000 ................
+ 0080 3f000000 00000000 04000000 01000000 ?...............
+ 0090 00000000 00000000 00000000 4c020000 ............L...
+ 00a0 00005300 74007200 69006e00 67004600 ..S.t.r.i.n.g.F.
+ 00b0 69006c00 65004900 6e006600 6f000000 i.l.e.I.n.f.o...
+ 00c0 28020000 00003000 34003000 37003000 (.....0.4.0.7.0.
+ 00d0 34006500 34000000 32000900 01004300 4.e.4...2.....C.
+ 00e0 6f006d00 70006100 6e007900 4e006100 o.m.p.a.n.y.N.a.
+ 00f0 6d006500 00000000 62006900 6e007500 m.e.....b.i.n.u.
+ 0100 74006900 6c007300 00000000 42000d00 t.i.l.s.....B...
+ 0110 01004600 69006c00 65004400 65007300 ..F.i.l.e.D.e.s.
+ 0120 63007200 69007000 74006900 6f006e00 c.r.i.p.t.i.o.n.
+ 0130 00000000 52004300 20006300 6f006d00 ....R.C. .c.o.m.
+ 0140 70006900 6c006500 72002e00 00000000 p.i.l.e.r.......
+ 0150 30000800 01004600 69006c00 65005600 0.....F.i.l.e.V.
+ 0160 65007200 73006900 6f006e00 00000000 e.r.s.i.o.n.....
+ 0170 31002e00 30002e00 30002e00 31000000 1...0...0...1...
+ 0180 38000c00 01004900 6e007400 65007200 8.....I.n.t.e.r.
+ 0190 6e006100 6c004e00 61006d00 65000000 n.a.l.N.a.m.e...
+ 01a0 77006900 6e006400 72006500 73002e00 w.i.n.d.r.e.s...
+ 01b0 65007800 65000000 68002200 01004c00 e.x.e...h."...L.
+ 01c0 65006700 61006c00 43006f00 70007900 e.g.a.l.C.o.p.y.
+ 01d0 72006900 67006800 74000000 28006300 r.i.g.h.t...(.c.
+ 01e0 29002000 46005300 46002e00 20004100 ). .F.S.F... .A.
+ 01f0 6c006c00 20007200 69006700 68007400 l.l. .r.i.g.h.t.
+ 0200 73002000 61007200 65002000 72006500 s. .a.r.e. .r.e.
+ 0210 73006500 72007600 65006400 2e000000 s.e.r.v.e.d.....
+ 0220 40000c00 01004f00 72006900 67006900 @.....O.r.i.g.i.
+ 0230 6e006100 6c004600 69006c00 65006e00 n.a.l.F.i.l.e.n.
+ 0240 61006d00 65000000 77006900 6e006400 a.m.e...w.i.n.d.
+ 0250 72006500 73002e00 65007800 65000000 r.e.s...e.x.e...
+ 0260 54001a00 01005000 72006f00 64007500 T.....P.r.o.d.u.
+ 0270 63007400 4e006100 6d006500 00000000 c.t.N.a.m.e.....
+ 0280 77006900 6e006400 6f007700 73002000 w.i.n.d.o.w.s. .
+ 0290 72006500 73006f00 75007200 63006500 r.e.s.o.u.r.c.e.
+ 02a0 20006300 6f006d00 70006900 6c006500 .c.o.m.p.i.l.e.
+ 02b0 72000000 34000800 01005000 72006f00 r...4.....P.r.o.
+ 02c0 64007500 63007400 56006500 72007300 d.u.c.t.V.e.r.s.
+ 02d0 69006f00 6e000000 31002e00 30002e00 i.o.n...1...0...
+ 02e0 30002e00 31000000 44000000 00005600 0...1...D.....V.
+ 02f0 61007200 46006900 6c006500 49006e00 a.r.F.i.l.e.I.n.
+ 0300 66006f00 00000000 24000400 00005400 f.o.....$.....T.
+ 0310 72006100 6e007300 6c006100 74006900 r.a.n.s.l.a.t.i.
+ 0320 6f006e00 00000000 0704e404 o.n.........
diff --git a/binutils/testsuite/binutils-all/windres/version_cat.rc b/binutils/testsuite/binutils-all/windres/version_cat.rc
new file mode 100644
index 0000000000000..5b70eada1e87e
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/version_cat.rc
@@ -0,0 +1,33 @@
+//#xfail x86_64-*-mingw*
+#include "windows.h"
+
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040704e4"
+ BEGIN
+ VALUE L"Company" "Name", L"binutil\x0073"
+ VALUE "File" "Description", L"RC " L"compiler."
+ VALUE "File" "Version", "1.0.0.1"
+ VALUE "Internal" "Name", "windres" L".exe"
+ VALUE "Legal" "Copyright", "(c) FSF." " All rights are reserved."
+ VALUE "Original" "Filename", L"windres" ".exe"
+ VALUE "Product" "Name", "windows resource " "compiler"
+ VALUE "Product" "Version", "1.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x407, 1252
+ END
+END
diff --git a/binutils/testsuite/binutils-all/windres/version_cat.rsd b/binutils/testsuite/binutils-all/windres/version_cat.rsd
new file mode 100644
index 0000000000000..85dd5d35281f9
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/version_cat.rsd
@@ -0,0 +1,55 @@
+
+version.res: file format binary
+
+Contents of section .data:
+ 0000 00000000 20000000 ffff0000 ffff0000 .... ...........
+ 0010 00000000 00000000 00000000 00000000 ................
+ 0020 ec020000 20000000 ffff1000 ffff0100 .... ...........
+ 0030 00000000 00000704 00000000 00000000 ................
+ 0040 ec023400 00005600 53005f00 56004500 ..4...V.S._.V.E.
+ 0050 52005300 49004f00 4e005f00 49004e00 R.S.I.O.N._.I.N.
+ 0060 46004f00 00000000 bd04effe 00000100 F.O.............
+ 0070 00000100 01000000 00000100 01000000 ................
+ 0080 3f000000 00000000 04000000 01000000 ?...............
+ 0090 00000000 00000000 00000000 4c020000 ............L...
+ 00a0 00005300 74007200 69006e00 67004600 ..S.t.r.i.n.g.F.
+ 00b0 69006c00 65004900 6e006600 6f000000 i.l.e.I.n.f.o...
+ 00c0 28020000 00003000 34003000 37003000 (.....0.4.0.7.0.
+ 00d0 34006500 34000000 32000900 01004300 4.e.4...2.....C.
+ 00e0 6f006d00 70006100 6e007900 4e006100 o.m.p.a.n.y.N.a.
+ 00f0 6d006500 00000000 62006900 6e007500 m.e.....b.i.n.u.
+ 0100 74006900 6c007300 00000000 42000d00 t.i.l.s.....B...
+ 0110 01004600 69006c00 65004400 65007300 ..F.i.l.e.D.e.s.
+ 0120 63007200 69007000 74006900 6f006e00 c.r.i.p.t.i.o.n.
+ 0130 00000000 52004300 20006300 6f006d00 ....R.C. .c.o.m.
+ 0140 70006900 6c006500 72002e00 00000000 p.i.l.e.r.......
+ 0150 30000800 01004600 69006c00 65005600 0.....F.i.l.e.V.
+ 0160 65007200 73006900 6f006e00 00000000 e.r.s.i.o.n.....
+ 0170 31002e00 30002e00 30002e00 31000000 1...0...0...1...
+ 0180 38000c00 01004900 6e007400 65007200 8.....I.n.t.e.r.
+ 0190 6e006100 6c004e00 61006d00 65000000 n.a.l.N.a.m.e...
+ 01a0 77006900 6e006400 72006500 73002e00 w.i.n.d.r.e.s...
+ 01b0 65007800 65000000 68002200 01004c00 e.x.e...h."...L.
+ 01c0 65006700 61006c00 43006f00 70007900 e.g.a.l.C.o.p.y.
+ 01d0 72006900 67006800 74000000 28006300 r.i.g.h.t...(.c.
+ 01e0 29002000 46005300 46002e00 20004100 ). .F.S.F... .A.
+ 01f0 6c006c00 20007200 69006700 68007400 l.l. .r.i.g.h.t.
+ 0200 73002000 61007200 65002000 72006500 s. .a.r.e. .r.e.
+ 0210 73006500 72007600 65006400 2e000000 s.e.r.v.e.d.....
+ 0220 40000c00 01004f00 72006900 67006900 @.....O.r.i.g.i.
+ 0230 6e006100 6c004600 69006c00 65006e00 n.a.l.F.i.l.e.n.
+ 0240 61006d00 65000000 77006900 6e006400 a.m.e...w.i.n.d.
+ 0250 72006500 73002e00 65007800 65000000 r.e.s...e.x.e...
+ 0260 54001a00 01005000 72006f00 64007500 T.....P.r.o.d.u.
+ 0270 63007400 4e006100 6d006500 00000000 c.t.N.a.m.e.....
+ 0280 77006900 6e006400 6f007700 73002000 w.i.n.d.o.w.s. .
+ 0290 72006500 73006f00 75007200 63006500 r.e.s.o.u.r.c.e.
+ 02a0 20006300 6f006d00 70006900 6c006500 .c.o.m.p.i.l.e.
+ 02b0 72000000 34000800 01005000 72006f00 r...4.....P.r.o.
+ 02c0 64007500 63007400 56006500 72007300 d.u.c.t.V.e.r.s.
+ 02d0 69006f00 6e000000 31002e00 30002e00 i.o.n...1...0...
+ 02e0 30002e00 31000000 44000000 00005600 0...1...D.....V.
+ 02f0 61007200 46006900 6c006500 49006e00 a.r.F.i.l.e.I.n.
+ 0300 66006f00 00000000 24000400 00005400 f.o.....$.....T.
+ 0310 72006100 6e007300 6c006100 74006900 r.a.n.s.l.a.t.i.
+ 0320 6f006e00 00000000 0704e404 o.n.........
diff --git a/binutils/testsuite/binutils-all/windres/windres.exp b/binutils/testsuite/binutils-all/windres/windres.exp
index 4189c551a6f7f..eb825d0f73649 100644
--- a/binutils/testsuite/binutils-all/windres/windres.exp
+++ b/binutils/testsuite/binutils-all/windres/windres.exp
@@ -1,4 +1,4 @@
-# Copyright 2001, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2001, 2003, 2004, 2006 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
@@ -19,13 +19,14 @@
# Written by DJ Delorie <dj@redhat.com>
-if {![istarget "i*86-*-*"]} {
+if {![istarget "i*86-*-*"] && ![istarget "x86_64-*-mingw*"] } {
return
}
if {![istarget "i*86-*-*pe*"] \
&& ![istarget "i*86-*-cygwin*"] \
- && ![istarget "i*86-*-mingw32*"] } {
+ && ![istarget "i*86-*-mingw32*"] \
+ && ![istarget "x86_64-*-mingw*"] } {
set target_xfail "yes"
} else {
set target_xfail "no"
diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp
index f7970b2926917..597437e6ffd76 100644
--- a/binutils/testsuite/lib/utils-lib.exp
+++ b/binutils/testsuite/lib/utils-lib.exp
@@ -1,4 +1,4 @@
-# Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004
+# Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004, 2006
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -161,9 +161,508 @@ proc is_elf_format {} {
# Returns target executable extension, if any.
#
proc exe_ext {} {
- if { [istarget *-*-mingw32] || [istarget *-*-cygwin*] } {
+ if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
return ".exe"
} else {
return ""
}
}
+
+# Copied and modified from gas.
+
+# run_dump_test FILE (optional:) EXTRA_OPTIONS
+#
+# Assemble a .s file, then run some utility on it and check the output.
+#
+# There should be an assembly language file named FILE.s in the test
+# suite directory, and a pattern file called FILE.d. `run_dump_test'
+# will assemble FILE.s, run some tool like `objdump', `objcopy', or
+# `nm' on the .o file to produce textual output, and then analyze that
+# with regexps. The FILE.d file specifies what program to run, and
+# what to expect in its output.
+#
+# The FILE.d file begins with zero or more option lines, which specify
+# flags to pass to the assembler, the program to run to dump the
+# assembler's output, and the options it wants. The option lines have
+# the syntax:
+#
+# # OPTION: VALUE
+#
+# OPTION is the name of some option, like "name" or "objdump", and
+# VALUE is OPTION's value. The valid options are described below.
+# Whitespace is ignored everywhere, except within VALUE. The option
+# list ends with the first line that doesn't match the above syntax.
+# However, a line within the options that begins with a #, but doesn't
+# have a recognizable option name followed by a colon, is considered a
+# comment and entirely ignored.
+#
+# The optional EXTRA_OPTIONS argument to `run_dump_test' is a list of
+# two-element lists. The first element of each is an option name, and
+# the second additional arguments to be added on to the end of the
+# option list as given in FILE.d. (If omitted, no additional options
+# are added.)
+#
+# The interesting options are:
+#
+# name: TEST-NAME
+# The name of this test, passed to DejaGNU's `pass' and `fail'
+# commands. If omitted, this defaults to FILE, the root of the
+# .s and .d files' names.
+#
+# as: FLAGS
+# When assembling FILE.s, pass FLAGS to the assembler.
+#
+# PROG: PROGRAM-NAME
+# The name of the program to run to analyze the .o file produced
+# by the assembler. This can be omitted; run_dump_test will guess
+# which program to run by seeing which of the flags options below
+# is present.
+#
+# objdump: FLAGS
+# nm: FLAGS
+# objcopy: FLAGS
+# Use the specified program to analyze the .o file, and pass it
+# FLAGS, in addition to the .o file name. Note that they are run
+# with LC_ALL=C in the environment to give consistent sorting
+# of symbols.
+#
+# source: SOURCE
+# Assemble the file SOURCE.s. If omitted, this defaults to FILE.s.
+# This is useful if several .d files want to share a .s file.
+#
+# target: GLOBS...
+# Run this test only on a specified list of targets. More precisely,
+# each glob in the space-separated list is passed to "istarget"; if
+# it evaluates true for any of them, the test will be run, otherwise
+# it will be marked unsupported.
+#
+# not-target: GLOBS...
+# Do not run this test on a specified list of targets. Again,
+# the each glob in the space-separated list is passed to
+# "istarget", and the test is run if it evaluates *false* for
+# *all* of them. Otherwise it will be marked unsupported.
+#
+# skip: GLOBS...
+# not-skip: GLOBS...
+# These are exactly the same as "not-target" and "target",
+# respectively, except that they do nothing at all if the check
+# fails. They should only be used in groups, to construct a single
+# test which is run on all targets but with variant options or
+# expected output on some targets. (For example, see
+# gas/arm/inst.d and gas/arm/wince_inst.d.)
+#
+# error: REGEX
+# An error with message matching REGEX must be emitted for the test
+# to pass. The PROG, objdump, nm and objcopy options have no
+# meaning and need not supplied if this is present.
+#
+# warning: REGEX
+# Expect a gas warning matching REGEX. It is an error to issue
+# both "error" and "warning".
+#
+# stderr: FILE
+# FILE contains regexp lines to be matched against the diagnostic
+# output of the assembler. This does not preclude the use of
+# PROG, nm, objdump, or objcopy.
+#
+# error-output: FILE
+# Means the same as 'stderr', but also indicates that the assembler
+# is expected to exit unsuccessfully (therefore PROG, objdump, nm,
+# and objcopy have no meaning and should not be supplied).
+#
+# Each option may occur at most once.
+#
+# After the option lines come regexp lines. `run_dump_test' calls
+# `regexp_diff' to compare the output of the dumping tool against the
+# regexps in FILE.d. `regexp_diff' is defined later in this file; see
+# further comments there.
+
+proc run_dump_test { name {extra_options {}} } {
+ global subdir srcdir
+ global OBJDUMP NM OBJCOPY READELF STRIP
+ global OBJDUMPFLAGS NMFLAGS OBJCOPYFLAGS READELFFLAGS STRIPFLAGS
+ global host_triplet
+ global env
+ global copyfile
+ global tempfile
+
+ if [string match "*/*" $name] {
+ set file $name
+ set name [file tail $name]
+ } else {
+ set file "$srcdir/$subdir/$name"
+ }
+ set opt_array [slurp_options "${file}.d"]
+ if { $opt_array == -1 } {
+ perror "error reading options from $file.d"
+ unresolved $subdir/$name
+ return
+ }
+ set opts(addr2line) {}
+ set opts(ar) {}
+ set opts(nm) {}
+ set opts(objcopy) {}
+ set opts(objdump) {}
+ set opts(strip) {}
+ set opts(ranlib) {}
+ set opts(readelf) {}
+ set opts(size) {}
+ set opts(strings) {}
+ set opts(name) {}
+ set opts(PROG) {}
+ set opts(DUMPPROG) {}
+ set opts(source) {}
+ set opts(target) {}
+ set opts(not-target) {}
+ set opts(skip) {}
+ set opts(not-skip) {}
+
+ foreach i $opt_array {
+ set opt_name [lindex $i 0]
+ set opt_val [lindex $i 1]
+ if ![info exists opts($opt_name)] {
+ perror "unknown option $opt_name in file $file.d"
+ unresolved $subdir/$name
+ return
+ }
+ if [string length $opts($opt_name)] {
+ perror "option $opt_name multiply set in $file.d"
+ unresolved $subdir/$name
+ return
+ }
+ set opts($opt_name) $opt_val
+ }
+
+ foreach i $extra_options {
+ set opt_name [lindex $i 0]
+ set opt_val [lindex $i 1]
+ if ![info exists opts($opt_name)] {
+ perror "unknown option $opt_name given in extra_opts"
+ unresolved $subdir/$name
+ return
+ }
+ # add extra option to end of existing option, adding space
+ # if necessary.
+ if [string length $opts($opt_name)] {
+ append opts($opt_name) " "
+ }
+ append opts($opt_name) $opt_val
+ }
+
+ if { $opts(name) == "" } {
+ set testname "$subdir/$name"
+ } else {
+ set testname $opts(name)
+ }
+ verbose "Testing $testname"
+
+ if {$opts(PROG) == ""} {
+ perror "program isn't set in $file.d"
+ unresolved $testname
+ return
+ }
+
+ set destopt ""
+ switch -- $opts(PROG) {
+ ar { set program ar }
+ objcopy { set program objcopy }
+ ranlib { set program ranlib }
+ strip {
+ set program strip
+ set destopt "-o"
+ }
+ strings { set program strings }
+ default {
+ perror "unrecognized program option $opts(PROG) in $file.d"
+ unresolved $testname
+ return }
+ }
+
+ set dumpprogram ""
+ if { $opts(DUMPPROG) != "" } {
+ switch -- $opts(DUMPPROG) {
+ addr2line { set dumpprogram addr2line }
+ nm { set dumpprogram nm }
+ objdump { set dumpprogram objdump }
+ readelf { set dumpprogram readelf }
+ size { set dumpprogram size }
+ default {
+ perror "unrecognized dump program option $opts(DUMPPROG) in $file.d"
+ unresolved $testname
+ return }
+ }
+ } else {
+ # Guess which program to run, by seeing which option was specified.
+ foreach p {objdump nm readelf} {
+ if {$opts($p) != ""} {
+ if {$dumpprogram != ""} {
+ perror "ambiguous dump program in $file.d"
+ unresolved $testname
+ return
+ } else {
+ set dumpprogram $p
+ }
+ }
+ }
+ }
+
+ # Handle skipping the test on specified targets.
+ # You can have both skip/not-skip and target/not-target, but you can't
+ # have both skip and not-skip, or target and not-target, in the same file.
+ if { $opts(skip) != "" } then {
+ if { $opts(not-skip) != "" } then {
+ perror "$testname: mixing skip and not-skip directives is invalid"
+ unresolved $testname
+ return
+ }
+ foreach glob $opts(skip) {
+ if {[istarget $glob]} { return }
+ }
+ }
+ if { $opts(not-skip) != "" } then {
+ set skip 1
+ foreach glob $opts(not-skip) {
+ if {[istarget $glob]} {
+ set skip 0
+ break
+ }
+ }
+ if {$skip} { return }
+ }
+ if { $opts(target) != "" } then {
+ if { $opts(not-target) != "" } then {
+ perror "$testname: mixing target and not-target directives is invalid"
+ unresolved $testname
+ return
+ }
+ set skip 1
+ foreach glob $opts(target) {
+ if {[istarget $glob]} {
+ set skip 0
+ break
+ }
+ }
+ if {$skip} {
+ unsupported $testname
+ return
+ }
+ }
+ if { $opts(not-target) != "" } then {
+ foreach glob $opts(not-target) {
+ if {[istarget $glob]} {
+ unsupported $testname
+ return
+ }
+ }
+ }
+
+ if { $opts(source) == "" } {
+ set srcfile ${file}.s
+ } else {
+ set srcfile $srcdir/$subdir/$opts(source)
+ }
+
+ set exec_output [binutils_assemble ${srcfile} tmpdir/bintest.o]
+ if [string match "" $exec_output] then {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ fail $testname
+ return
+ }
+
+ set progopts1 $opts($program)
+ eval set progopts \$[string toupper $program]FLAGS
+ eval set binary \$[string toupper $program]
+
+ set exec_output [binutils_run $binary "$progopts $progopts1 $tempfile $destopt ${copyfile}.o"]
+ if ![string match "" $exec_output] {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ fail $testname
+ return
+ }
+
+ set progopts1 $opts($dumpprogram)
+ eval set progopts \$[string toupper $dumpprogram]FLAGS
+ eval set binary \$[string toupper $dumpprogram]
+
+ if { [which $binary] == 0 } {
+ untested $testname
+ return
+ }
+
+ verbose "running $binary $progopts $progopts1" 3
+
+ set cmd "$binary $progopts $progopts1 ${copyfile}.o > tmpdir/dump.out"
+
+ # Ensure consistent sorting of symbols
+ if {[info exists env(LC_ALL)]} {
+ set old_lc_all $env(LC_ALL)
+ }
+ set env(LC_ALL) "C"
+ send_log "$cmd\n"
+ catch "exec $cmd" comp_output
+ if {[info exists old_lc_all]} {
+ set env(LC_ALL) $old_lc_all
+ } else {
+ unset env(LC_ALL)
+ }
+ set comp_output [prune_warnings $comp_output]
+ if ![string match "" $comp_output] then {
+ send_log "$comp_output\n"
+ fail $testname
+ return
+ }
+
+ verbose_eval {[file_contents "tmpdir/dump.out"]} 3
+ if { [regexp_diff "tmpdir/dump.out" "${file}.d"] } then {
+ fail $testname
+ verbose "output is [file_contents "tmpdir/dump.out"]" 2
+ return
+ }
+
+ pass $testname
+}
+
+proc slurp_options { file } {
+ if [catch { set f [open $file r] } x] {
+ #perror "couldn't open `$file': $x"
+ perror "$x"
+ return -1
+ }
+ set opt_array {}
+ # whitespace expression
+ set ws {[ ]*}
+ set nws {[^ ]*}
+ # whitespace is ignored anywhere except within the options list;
+ # option names are alphabetic plus dash
+ set pat "^#${ws}(\[a-zA-Z-\]*)$ws:${ws}(.*)$ws\$"
+ while { [gets $f line] != -1 } {
+ set line [string trim $line]
+ # Whitespace here is space-tab.
+ if [regexp $pat $line xxx opt_name opt_val] {
+ # match!
+ lappend opt_array [list $opt_name $opt_val]
+ } elseif {![regexp "^#" $line ]} {
+ break
+ }
+ }
+ close $f
+ return $opt_array
+}
+
+# regexp_diff, based on simple_diff taken from ld test suite
+# compares two files line-by-line
+# file1 contains strings, file2 contains regexps and #-comments
+# blank lines are ignored in either file
+# returns non-zero if differences exist
+#
+proc regexp_diff { file_1 file_2 } {
+
+ set eof -1
+ set end_1 0
+ set end_2 0
+ set differences 0
+ set diff_pass 0
+
+ if [file exists $file_1] then {
+ set file_a [open $file_1 r]
+ } else {
+ perror "$file_1 doesn't exist"
+ return 1
+ }
+
+ if [file exists $file_2] then {
+ set file_b [open $file_2 r]
+ } else {
+ perror "$file_2 doesn't exist"
+ close $file_a
+ return 1
+ }
+
+ verbose " Regexp-diff'ing: $file_1 $file_2" 2
+
+ while { 1 } {
+ set line_a ""
+ set line_b ""
+ while { [string length $line_a] == 0 } {
+ if { [gets $file_a line_a] == $eof } {
+ set end_1 1
+ break
+ }
+ }
+ while { [string length $line_b] == 0 || [string match "#*" $line_b] } {
+ if [ string match "#pass" $line_b ] {
+ set end_2 1
+ set diff_pass 1
+ break
+ } elseif [ string match "#..." $line_b ] {
+ if { [gets $file_b line_b] == $eof } {
+ set end_2 1
+ set diff_pass 1
+ break
+ }
+ verbose "looking for \"^$line_b$\"" 3
+ while { ![regexp "^$line_b$" "$line_a"] } {
+ verbose "skipping \"$line_a\"" 3
+ if { [gets $file_a line_a] == $eof } {
+ set end_1 1
+ break
+ }
+ }
+ break
+ }
+ if { [gets $file_b line_b] == $eof } {
+ set end_2 1
+ break
+ }
+ }
+
+ if { $diff_pass } {
+ break
+ } elseif { $end_1 && $end_2 } {
+ break
+ } elseif { $end_1 } {
+ send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n"
+ verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3
+ set differences 1
+ break
+ } elseif { $end_2 } {
+ send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n"
+ verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3
+ set differences 1
+ break
+ } else {
+ verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3
+ if ![regexp "^$line_b$" "$line_a"] {
+ send_log "regexp_diff match failure\n"
+ send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n"
+ verbose "regexp_diff match failure\n" 3
+ set differences 1
+ }
+ }
+ }
+
+ if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } {
+ send_log "$file_1 and $file_2 are different lengths\n"
+ verbose "$file_1 and $file_2 are different lengths" 3
+ set differences 1
+ }
+
+ close $file_a
+ close $file_b
+
+ return $differences
+}
+
+proc file_contents { filename } {
+ set file [open $filename r]
+ set contents [read $file]
+ close $file
+ return $contents
+}
+
+proc verbose_eval { expr { level 1 } } {
+ global verbose
+ if $verbose>$level then { eval verbose "$expr" $level }
+}