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 (C) 2010-2014 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 31check() 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 45check arm_bl_out_of_range.stdout \ 46 " 4000004: eb00003d bl 4000100 <.*>" 47check arm_bl_out_of_range.stdout \ 48 " 4000008: eb00003e bl 4000108 <.*>" 49check arm_bl_out_of_range.stdout \ 50 " 4000100: e51ff004 ldr pc, \[pc, #-4\]" 51check arm_bl_out_of_range.stdout \ 52 " 4000104: 02000008 " 53check arm_bl_out_of_range.stdout \ 54 " 4000108: e51ff004 ldr pc, \[pc, #-4\]" 55check arm_bl_out_of_range.stdout \ 56 " 400010c: 06000010 " 57 58check thumb_bl_out_of_range.stdout \ 59 " 800004: f000 e87c blx 800100 <.*>" 60check thumb_bl_out_of_range.stdout \ 61 " 800008: f000 e87e blx 800108 <.*>" 62check thumb_bl_out_of_range.stdout \ 63 " 800100: e51ff004 ldr pc, \[pc, #-4\]" 64check thumb_bl_out_of_range.stdout \ 65 " 800104: 00400007 " 66check thumb_bl_out_of_range.stdout \ 67 " 800108: e51ff004 ldr pc, \[pc, #-4\]" 68check thumb_bl_out_of_range.stdout \ 69 " 80010c: 00c0000d " 70 71check thumb_blx_out_of_range.stdout \ 72 " 800004: f000 e87c blx 800100 <.*>" 73check thumb_blx_out_of_range.stdout \ 74 " 80000a: f000 e87e blx 800108 <.*>" 75check thumb_blx_out_of_range.stdout \ 76 " 800100: e51ff004 ldr pc, \[pc, #-4\]" 77check thumb_blx_out_of_range.stdout \ 78 " 800104: 00400004 " 79check thumb_blx_out_of_range.stdout \ 80 " 800108: e51ff004 ldr pc, \[pc, #-4\]" 81check thumb_blx_out_of_range.stdout \ 82 " 80010c: 00c0000c " 83 84check thumb_bl_out_of_range_local.stdout \ 85 " 800004: f000 e87c blx 800100 <.*>" 86check thumb_bl_out_of_range_local.stdout \ 87 " 800008: f000 e87e blx 800108 <.*>" 88check thumb_bl_out_of_range_local.stdout \ 89 " 800100: e51ff004 ldr pc, \[pc, #-4\]" 90check thumb_bl_out_of_range_local.stdout \ 91 " 800104: 00400007 " 92check thumb_bl_out_of_range_local.stdout \ 93 " 800108: e51ff004 ldr pc, \[pc, #-4\]" 94check thumb_bl_out_of_range_local.stdout \ 95 " 80010c: 00c0000d " 96 97check thumb2_bl_out_of_range.stdout \ 98 " 2000004: f000 e87c blx 2000100 <.*>" 99check thumb2_bl_out_of_range.stdout \ 100 " 2000008: f000 e87e blx 2000108 <.*>" 101check thumb2_bl_out_of_range.stdout \ 102 " 2000100: e51ff004 ldr pc, \[pc, #-4\]" 103check thumb2_bl_out_of_range.stdout \ 104 " 2000104: 01000007 " 105check thumb2_bl_out_of_range.stdout \ 106 " 2000108: e51ff004 ldr pc, \[pc, #-4\]" 107check thumb2_bl_out_of_range.stdout \ 108 " 200010c: 0300000d " 109 110check thumb2_blx_out_of_range.stdout \ 111 " 2000004: f000 e87c blx 2000100 <.*>" 112check thumb2_blx_out_of_range.stdout \ 113 " 200000a: f000 e87e blx 2000108 <.*>" 114check thumb2_blx_out_of_range.stdout \ 115 " 2000100: e51ff004 ldr pc, \[pc, #-4\]" 116check thumb2_blx_out_of_range.stdout \ 117 " 2000104: 01000004 " 118check thumb2_blx_out_of_range.stdout \ 119 " 2000108: e51ff004 ldr pc, \[pc, #-4\]" 120check thumb2_blx_out_of_range.stdout \ 121 " 200010c: 0300000c " 122 123exit 0 124