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