Copyright update for binutils
[external/binutils.git] / binutils / testsuite / binutils-all / arm / objdump.exp
1 #   Copyright (C) 2004-2016 Free Software Foundation, Inc.
2
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 3 of the License, or
6 # (at your option) any later version.
7
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.
12
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17 if {![istarget "arm*-*-*"]} then {
18   return
19 }
20
21 if {![is_remote host] && [which $OBJDUMP] == 0} then {
22     perror "$OBJDUMP does not exist"
23     return
24 }
25
26 send_user "Version [binutil_version $OBJDUMP]"
27
28 ###########################
29 # Set up the test of movem.s
30 ###########################
31
32 if {![binutils_assemble $srcdir/$subdir/thumb2-cond.s tmpdir/thumb2-cond.o]} then {
33     return
34 }
35
36 if [is_remote host] {
37     set objfile [remote_download host tmpdir/thumb2-cond.o]
38 } else {
39     set objfile tmpdir/thumb2-cond.o
40 }
41
42 # Make sure that conditional instructions are correctly decoded.
43
44 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=6 $objfile"]
45
46 set want "bcc.w\[ \t\]*e12.*bx\[ \t\]*lr"
47
48 if [regexp $want $got] then {
49     pass "thumb2-cond test1"
50 } else {
51     fail "thumb2-cond test1"
52 }
53
54 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=10 $objfile"]
55
56 set want "bx\[ \t\]*lr"
57
58 if [regexp $want $got] then {
59     pass "thumb2-cond test2"
60 } else {
61     fail "thumb2-cond test2"
62 }
63
64 ###########################
65 # Set up the test of multiple disassemblies
66 ###########################
67
68 if {![binutils_assemble $srcdir/$subdir/simple.s tmpdir/simple.o]} then {
69     return
70 }
71
72 if [is_remote host] {
73     set objfile [remote_download host tmpdir/simple.o]
74 } else {
75     set objfile tmpdir/simple.o
76 }
77
78 # Make sure multiple disassemblies come out the same
79
80 set got [binutils_run $OBJDUMP "-dr $objfile $objfile"]
81
82 set want "$objfile:\[ \]*file format.*$objfile:\[ \]*file format.*push.*add.*sub.*str.*add.*ldmfd"
83
84 if [regexp $want $got] then {
85     pass "multiple input files"
86 } else {
87     fail "multiple input files"
88 }
89
90 if {![binutils_assemble $srcdir/$subdir/rvct_symbol.s tmpdir/rvct_symbol.o]} then {
91     return
92 }
93
94 if [is_remote host] {
95     set objfile [remote_download host tmpdir/rvct_symbol.o]
96 } else {
97     set objfile tmpdir/rvct_symbol.o
98 }
99
100 # Make sure multiple disassemblies come out the same
101
102 set got [binutils_run $OBJDUMP "-D $objfile $objfile"]
103
104 set want "foo.*global_a.*global_b"
105
106 if [regexp $want $got] then {
107     pass "skip rvct symbol"
108 } else {
109     fail "skip rvct symbol"
110 }