summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/gold/testsuite/arm_branch_out_of_range.sh
blob: aba1873bc2df9b981761378753f1207594fe3a02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/sh

# arm_branch_out_of_range.sh -- test ARM/THUMB/THUMB branch instructions whose
# targets are just out of the branch range limits.

# Copyright (C) 2010-2014 Free Software Foundation, Inc.
# Written by Doug Kwan <dougkwan@google.com>

# This file is part of gold.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.

# This file goes with the assembler source files arm_bl_out_of_range.s,
# thumb_bl_out_of_range.s and thumb_bl_out_of_range_local.s that are assembled
# and linked to check that branches whose target are just out of the branch
# range limits are handle correctly.

check()
{
    file=$1
    pattern=$2

    found=`grep "$pattern" $file`
    if test -z "$found"; then
	echo "pattern \"$pattern\" not found in file $file."
	exit 1
    fi
}

# This is a bit crude.  Also, there are tabs in the grep patterns. 

check arm_bl_out_of_range.stdout \
  " 4000004:	eb00003d 	bl	4000100 <.*>"
check arm_bl_out_of_range.stdout \
  " 4000008:	eb00003e 	bl	4000108 <.*>"
check arm_bl_out_of_range.stdout \
  " 4000100:	e51ff004 	ldr	pc, \[pc, #-4\]"
check arm_bl_out_of_range.stdout \
  " 4000104:	02000008 "
check arm_bl_out_of_range.stdout \
  " 4000108:	e51ff004 	ldr	pc, \[pc, #-4\]"
check arm_bl_out_of_range.stdout \
  " 400010c:	06000010 "

check thumb_bl_out_of_range.stdout \
  " 800004:	f000 e87c 	blx	800100 <.*>"
check thumb_bl_out_of_range.stdout \
  " 800008:	f000 e87e 	blx	800108 <.*>"
check thumb_bl_out_of_range.stdout \
  " 800100:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb_bl_out_of_range.stdout \
  " 800104:	00400007 "
check thumb_bl_out_of_range.stdout \
  " 800108:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb_bl_out_of_range.stdout \
  " 80010c:	00c0000d "

check thumb_blx_out_of_range.stdout \
  " 800004:	f000 e87c 	blx	800100 <.*>"
check thumb_blx_out_of_range.stdout \
  " 80000a:	f000 e87e 	blx	800108 <.*>"
check thumb_blx_out_of_range.stdout \
  " 800100:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb_blx_out_of_range.stdout \
  " 800104:	00400004 "
check thumb_blx_out_of_range.stdout \
  " 800108:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb_blx_out_of_range.stdout \
  " 80010c:	00c0000c "

check thumb_bl_out_of_range_local.stdout \
  " 800004:	f000 e87c 	blx	800100 <.*>"
check thumb_bl_out_of_range_local.stdout \
  " 800008:	f000 e87e 	blx	800108 <.*>"
check thumb_bl_out_of_range_local.stdout \
  " 800100:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb_bl_out_of_range_local.stdout \
  " 800104:	00400007 "
check thumb_bl_out_of_range_local.stdout \
  " 800108:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb_bl_out_of_range_local.stdout \
  " 80010c:	00c0000d "

check thumb2_bl_out_of_range.stdout \
  " 2000004:	f000 e87c 	blx	2000100 <.*>"
check thumb2_bl_out_of_range.stdout \
  " 2000008:	f000 e87e 	blx	2000108 <.*>"
check thumb2_bl_out_of_range.stdout \
  " 2000100:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb2_bl_out_of_range.stdout \
  " 2000104:	01000007 "
check thumb2_bl_out_of_range.stdout \
  " 2000108:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb2_bl_out_of_range.stdout \
  " 200010c:	0300000d "

check thumb2_blx_out_of_range.stdout \
  " 2000004:	f000 e87c 	blx	2000100 <.*>"
check thumb2_blx_out_of_range.stdout \
  " 200000a:	f000 e87e 	blx	2000108 <.*>"
check thumb2_blx_out_of_range.stdout \
  " 2000100:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb2_blx_out_of_range.stdout \
  " 2000104:	01000004 "
check thumb2_blx_out_of_range.stdout \
  " 2000108:	e51ff004 	ldr	pc, \[pc, #-4\]"
check thumb2_blx_out_of_range.stdout \
  " 200010c:	0300000c "

exit 0