Upload Tizen:Base source
[external/binutils.git] / gold / testsuite / arm_branch_out_of_range.sh
1 #!/bin/sh
2
3 # arm_branch_out_of_range.sh -- test ARM/THUMB/THUMB branch instructions whose
4 # targets are just out of the branch range limits.
5
6 # Copyright 2010 Free Software Foundation, Inc.
7 # Written by Doug Kwan <dougkwan@google.com>
8
9 # This file is part of gold.
10
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or
14 # (at your option) any later version.
15
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
24 # MA 02110-1301, USA.
25
26 # This file goes with the assembler source files arm_bl_out_of_range.s,
27 # thumb_bl_out_of_range.s and thumb_bl_out_of_range_local.s that are assembled
28 # and linked to check that branches whose target are just out of the branch
29 # range limits are handle correctly.
30
31 check()
32 {
33     file=$1
34     pattern=$2
35
36     found=`grep "$pattern" $file`
37     if test -z "$found"; then
38         echo "pattern \"$pattern\" not found in file $file."
39         exit 1
40     fi
41 }
42
43 # This is a bit crude.  Also, there are tabs in the grep patterns. 
44
45 check arm_bl_out_of_range.stdout \
46   " 4000004:    eb00003d        bl      4000100 <.*>"
47 check arm_bl_out_of_range.stdout \
48   " 4000008:    eb00003e        bl      4000108 <.*>"
49 check arm_bl_out_of_range.stdout \
50   " 4000100:    e51ff004        ldr     pc, \[pc, #-4\]"
51 check arm_bl_out_of_range.stdout \
52   " 4000104:    02000008 "
53 check arm_bl_out_of_range.stdout \
54   " 4000108:    e51ff004        ldr     pc, \[pc, #-4\]"
55 check arm_bl_out_of_range.stdout \
56   " 400010c:    06000010 "
57
58 check thumb_bl_out_of_range.stdout \
59   " 800004:     f000 e87c       blx     800100 <.*>"
60 check thumb_bl_out_of_range.stdout \
61   " 800008:     f000 e87e       blx     800108 <.*>"
62 check thumb_bl_out_of_range.stdout \
63   " 800100:     e51ff004        ldr     pc, \[pc, #-4\]"
64 check thumb_bl_out_of_range.stdout \
65   " 800104:     00400007 "
66 check thumb_bl_out_of_range.stdout \
67   " 800108:     e51ff004        ldr     pc, \[pc, #-4\]"
68 check thumb_bl_out_of_range.stdout \
69   " 80010c:     00c0000d "
70
71 check thumb_blx_out_of_range.stdout \
72   " 800004:     f000 e87c       blx     800100 <.*>"
73 check thumb_blx_out_of_range.stdout \
74   " 80000a:     f000 e87e       blx     800108 <.*>"
75 check thumb_blx_out_of_range.stdout \
76   " 800100:     e51ff004        ldr     pc, \[pc, #-4\]"
77 check thumb_blx_out_of_range.stdout \
78   " 800104:     00400004 "
79 check thumb_blx_out_of_range.stdout \
80   " 800108:     e51ff004        ldr     pc, \[pc, #-4\]"
81 check thumb_blx_out_of_range.stdout \
82   " 80010c:     00c0000c "
83
84 check thumb_bl_out_of_range_local.stdout \
85   " 800004:     f000 e87c       blx     800100 <.*>"
86 check thumb_bl_out_of_range_local.stdout \
87   " 800008:     f000 e87e       blx     800108 <.*>"
88 check thumb_bl_out_of_range_local.stdout \
89   " 800100:     e51ff004        ldr     pc, \[pc, #-4\]"
90 check thumb_bl_out_of_range_local.stdout \
91   " 800104:     00400007 "
92 check thumb_bl_out_of_range_local.stdout \
93   " 800108:     e51ff004        ldr     pc, \[pc, #-4\]"
94 check thumb_bl_out_of_range_local.stdout \
95   " 80010c:     00c0000d "
96
97 check thumb2_bl_out_of_range.stdout \
98   " 2000004:    f000 e87c       blx     2000100 <.*>"
99 check thumb2_bl_out_of_range.stdout \
100   " 2000008:    f000 e87e       blx     2000108 <.*>"
101 check thumb2_bl_out_of_range.stdout \
102   " 2000100:    e51ff004        ldr     pc, \[pc, #-4\]"
103 check thumb2_bl_out_of_range.stdout \
104   " 2000104:    01000007 "
105 check thumb2_bl_out_of_range.stdout \
106   " 2000108:    e51ff004        ldr     pc, \[pc, #-4\]"
107 check thumb2_bl_out_of_range.stdout \
108   " 200010c:    0300000d "
109
110 check thumb2_blx_out_of_range.stdout \
111   " 2000004:    f000 e87c       blx     2000100 <.*>"
112 check thumb2_blx_out_of_range.stdout \
113   " 200000a:    f000 e87e       blx     2000108 <.*>"
114 check thumb2_blx_out_of_range.stdout \
115   " 2000100:    e51ff004        ldr     pc, \[pc, #-4\]"
116 check thumb2_blx_out_of_range.stdout \
117   " 2000104:    01000004 "
118 check thumb2_blx_out_of_range.stdout \
119   " 2000108:    e51ff004        ldr     pc, \[pc, #-4\]"
120 check thumb2_blx_out_of_range.stdout \
121   " 200010c:    0300000c "
122
123 exit 0