Commit | Line | Data |
---|---|---|
2a2b6d42 DK |
1 | #!/bin/sh |
2 | ||
3 | # arm_branch_in_range.sh -- test ARM/THUMB/THUMB branch instructions whose | |
4 | # targets are just within the branch range limits. | |
5 | ||
b3adc24a | 6 | # Copyright (C) 2010-2020 Free Software Foundation, Inc. |
2a2b6d42 DK |
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_in_range.s | |
27 | # thumb_bl_in_range.s that are assembled and linked to check that branches | |
28 | # whose target are just within the branch range limits are handle correctly. | |
29 | ||
30 | check() | |
31 | { | |
32 | file=$1 | |
33 | pattern=$2 | |
34 | ||
35 | found=`grep "$pattern" $file` | |
36 | if test -z "$found"; then | |
37 | echo "pattern \"$pattern\" not found in file $file." | |
38 | exit 1 | |
39 | fi | |
40 | } | |
41 | ||
42 | # This is a bit crude. Also, there are tabs in the grep patterns. | |
43 | ||
44 | check arm_bl_in_range.stdout \ | |
45 | " 4000004: eb800000 bl 200000c <_backward_target>" | |
46 | check arm_bl_in_range.stdout \ | |
47 | " 4000008: eb7fffff bl 600000c <_forward_target>" | |
48 | check thumb_bl_in_range.stdout \ | |
49 | " 800004: f400 f800 bl 400008 <_backward_target>" | |
50 | check thumb_bl_in_range.stdout \ | |
51 | " 800008: f3ff ffff bl c0000a <_forward_target>" | |
52 | check thumb2_bl_in_range.stdout \ | |
53 | " 2000004: f400 d000 bl 1000008 <_backward_target>" | |
54 | check thumb2_bl_in_range.stdout \ | |
55 | " 2000008: f3ff d7ff bl 300000a <_forward_target>" | |
a2c7281b DK |
56 | check thumb_blx_in_range.stdout \ |
57 | " 800006: f400 e800 blx 400008 <_backward_target>" | |
58 | check thumb_blx_in_range.stdout \ | |
59 | " 80000c: f3ff effe blx c0000c <_forward_target>" | |
60 | check thumb2_blx_in_range.stdout \ | |
61 | " 2000006: f400 c000 blx 1000008 <_backward_target>" | |
62 | check thumb2_blx_in_range.stdout \ | |
63 | " 200000c: f3ff c7fe blx 300000c <_forward_target>" | |
57eb9b50 DK |
64 | check arm_thm_jump11.stdout \ |
65 | " 8804: e400 b.n 8008 <_backward_target>" | |
66 | check arm_thm_jump11.stdout \ | |
67 | " 8806: e3ff b.n 9008 <_forward_target>" | |
68 | check arm_thm_jump8.stdout \ | |
69 | " 8104: d080 beq.n 8008 <_backward_target>" | |
70 | check arm_thm_jump8.stdout \ | |
71 | " 8106: d07f beq.n 8208 <_forward_target>" | |
72 | ||
2a2b6d42 | 73 | exit 0 |