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