1 # Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-dejagnu@prep.ai.mit.edu
20 # This file was written by Rob Savoye <rob@cygnus.com>
21 # and rewritten by Ian Lance Taylor <ian@cygnus.com>
23 if ![is_remote host] {
24 if {[which $OBJDUMP] == 0} then {
25 perror "$OBJDUMP does not exist"
30 send_user "Version [binutil_version $OBJDUMP]"
32 # Simple test of objdump -i
34 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"]
36 set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|d10v|h8|hppa|i386|i860|i960|m32r|m68k|m88k|mips|mn10200|mn10300|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k|z8001|z8002)"
38 set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|d10v|h8|hppa|i386|i860|i960|d30v|m32r|m68k|m88k|mips|mn10200|mn10300|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k|z8001|z8002)"
41 set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|d10v|h8|hppa|i386|i860|i960|m32r|m68k|m88k|mips|mn10200|mn10300|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|txvu|vax|we32k|z8k|z8001|z8002)"
44 # Make sure the target CPU shows up in the list.
45 if ![regexp $cpus_expected $target_cpu] {
46 regsub "^\[(\]" "$cpus_expected" "(${target_cpu}|" cpus_expected;
49 set want "BFD header file version.*srec.*header .* endian.*, data .* endian.*$cpus_expected"
51 if [regexp $want $got] then {
57 # The remaining tests require a test file.
60 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
64 set testfile [remote_download host tmpdir/bintest.o]
66 set testfile tmpdir/bintest.o
71 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $testfile"]
73 set want "$testfile:\[ \]*file format.*architecture:\[ \]*${cpus_expected}.*HAS_RELOC.*HAS_SYMS"
75 if ![regexp $want $got] then {
83 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $testfile"]
85 set want "$testfile:\[ \]*file format.*Sections.*\[0-9\]+\[ \]+\[^ \]*(text|TEXT|\\\$CODE\\\$)\[^ \]*\[ \]*(\[0-9a-fA-F\]+).*\[0-9\]+\[ \]+\[^ \]*(data|DATA)\[^ \]*\[ \]*(\[0-9a-fA-F\]+)"
87 if ![regexp $want $got all text_name text_size data_name data_size] then {
90 verbose "text name is $text_name size is $text_size"
91 verbose "data name is $data_name size is $data_size"
92 if {[expr "0x$text_size"] < 8 || [expr "0x$data_size"] < 4} then {
93 send_log "sizes too small\n"
102 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $testfile"]
104 if [info exists vars] then { unset vars }
105 while {[regexp "(\[a-z\]*_symbol)(.*)" $got all symbol rest]} {
110 if {![info exists vars(text_symbol)] \
111 || ![info exists vars(data_symbol)] \
112 || ![info exists vars(common_symbol)] \
113 || ![info exists vars(external_symbol)]} then {
121 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $testfile"]
123 set want "$testfile:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|\\\$CODE\\\$)\[^\]\]*\\\].*external_symbol"
125 if [regexp $want $got] then {
133 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s $testfile"]
135 set want "$testfile:\[ \]*file format.*Contents.*(text|TEXT|\\\$CODE\\\$)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000)"
137 if [regexp $want $got] then {
143 # Options which are not tested: -a -d -D -R -T -x -l --stabs
144 # I don't see any generic way to test any of these other than -a.
145 # Tests could be written for specific targets, and that should be done
146 # if specific problems are found.