arm_branch_in_range.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. # arm_branch_in_range.sh -- test ARM/THUMB/THUMB branch instructions whose
  3. # targets are just within the branch range limits.
  4. # Copyright (C) 2010-2022 Free Software Foundation, Inc.
  5. # Written by Doug Kwan <dougkwan@google.com>
  6. # This file is part of gold.
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or
  10. # (at your option) any later version.
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  18. # MA 02110-1301, USA.
  19. # This file goes with the assembler source files arm_bl_in_range.s
  20. # thumb_bl_in_range.s that are assembled and linked to check that branches
  21. # whose target are just within the branch range limits are handle correctly.
  22. check()
  23. {
  24. file=$1
  25. pattern=$2
  26. found=`grep "$pattern" $file`
  27. if test -z "$found"; then
  28. echo "pattern \"$pattern\" not found in file $file."
  29. exit 1
  30. fi
  31. }
  32. # This is a bit crude. Also, there are tabs in the grep patterns.
  33. check arm_bl_in_range.stdout \
  34. " 4000004: eb800000 bl 200000c <_backward_target>"
  35. check arm_bl_in_range.stdout \
  36. " 4000008: eb7fffff bl 600000c <_forward_target>"
  37. check thumb_bl_in_range.stdout \
  38. " 800004: f400 f800 bl 400008 <_backward_target>"
  39. check thumb_bl_in_range.stdout \
  40. " 800008: f3ff ffff bl c0000a <_forward_target>"
  41. check thumb2_bl_in_range.stdout \
  42. " 2000004: f400 d000 bl 1000008 <_backward_target>"
  43. check thumb2_bl_in_range.stdout \
  44. " 2000008: f3ff d7ff bl 300000a <_forward_target>"
  45. check thumb_blx_in_range.stdout \
  46. " 800006: f400 e800 blx 400008 <_backward_target>"
  47. check thumb_blx_in_range.stdout \
  48. " 80000c: f3ff effe blx c0000c <_forward_target>"
  49. check thumb2_blx_in_range.stdout \
  50. " 2000006: f400 c000 blx 1000008 <_backward_target>"
  51. check thumb2_blx_in_range.stdout \
  52. " 200000c: f3ff c7fe blx 300000c <_forward_target>"
  53. check arm_thm_jump11.stdout \
  54. " 8804: e400 b.n 8008 <_backward_target>"
  55. check arm_thm_jump11.stdout \
  56. " 8806: e3ff b.n 9008 <_forward_target>"
  57. check arm_thm_jump8.stdout \
  58. " 8104: d080 beq.n 8008 <_backward_target>"
  59. check arm_thm_jump8.stdout \
  60. " 8106: d07f beq.n 8208 <_forward_target>"
  61. exit 0