arm_branch_out_of_range.sh 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #!/bin/sh
  2. # arm_branch_out_of_range.sh -- test ARM/THUMB/THUMB branch instructions whose
  3. # targets are just out of the branch range limits.
  4. # Copyright (C) 2010-2015 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_out_of_range.s,
  20. # thumb_bl_out_of_range.s and thumb_bl_out_of_range_local.s that are assembled
  21. # and linked to check that branches whose target are just out of the branch
  22. # range limits are handle correctly.
  23. check()
  24. {
  25. file=$1
  26. pattern=$2
  27. found=`grep "$pattern" $file`
  28. if test -z "$found"; then
  29. echo "pattern \"$pattern\" not found in file $file."
  30. exit 1
  31. fi
  32. }
  33. # This is a bit crude. Also, there are tabs in the grep patterns.
  34. check arm_bl_out_of_range.stdout \
  35. " 4000004: eb00003d bl 4000100 <.*>"
  36. check arm_bl_out_of_range.stdout \
  37. " 4000008: eb00003e bl 4000108 <.*>"
  38. check arm_bl_out_of_range.stdout \
  39. " 4000100: e51ff004 ldr pc, \[pc, #-4\]"
  40. check arm_bl_out_of_range.stdout \
  41. " 4000104: 02000008 "
  42. check arm_bl_out_of_range.stdout \
  43. " 4000108: e51ff004 ldr pc, \[pc, #-4\]"
  44. check arm_bl_out_of_range.stdout \
  45. " 400010c: 06000010 "
  46. check thumb_bl_out_of_range.stdout \
  47. " 800004: f000 e87c blx 800100 <.*>"
  48. check thumb_bl_out_of_range.stdout \
  49. " 800008: f000 e87e blx 800108 <.*>"
  50. check thumb_bl_out_of_range.stdout \
  51. " 800100: e51ff004 ldr pc, \[pc, #-4\]"
  52. check thumb_bl_out_of_range.stdout \
  53. " 800104: 00400007 "
  54. check thumb_bl_out_of_range.stdout \
  55. " 800108: e51ff004 ldr pc, \[pc, #-4\]"
  56. check thumb_bl_out_of_range.stdout \
  57. " 80010c: 00c0000d "
  58. check thumb_blx_out_of_range.stdout \
  59. " 800004: f000 e87c blx 800100 <.*>"
  60. check thumb_blx_out_of_range.stdout \
  61. " 80000a: f000 e87e blx 800108 <.*>"
  62. check thumb_blx_out_of_range.stdout \
  63. " 800100: e51ff004 ldr pc, \[pc, #-4\]"
  64. check thumb_blx_out_of_range.stdout \
  65. " 800104: 00400004 "
  66. check thumb_blx_out_of_range.stdout \
  67. " 800108: e51ff004 ldr pc, \[pc, #-4\]"
  68. check thumb_blx_out_of_range.stdout \
  69. " 80010c: 00c0000c "
  70. check thumb_bl_out_of_range_local.stdout \
  71. " 800004: f000 e87c blx 800100 <.*>"
  72. check thumb_bl_out_of_range_local.stdout \
  73. " 800008: f000 e87e blx 800108 <.*>"
  74. check thumb_bl_out_of_range_local.stdout \
  75. " 800100: e51ff004 ldr pc, \[pc, #-4\]"
  76. check thumb_bl_out_of_range_local.stdout \
  77. " 800104: 00400007 "
  78. check thumb_bl_out_of_range_local.stdout \
  79. " 800108: e51ff004 ldr pc, \[pc, #-4\]"
  80. check thumb_bl_out_of_range_local.stdout \
  81. " 80010c: 00c0000d "
  82. check thumb2_bl_out_of_range.stdout \
  83. " 2000004: f000 e87c blx 2000100 <.*>"
  84. check thumb2_bl_out_of_range.stdout \
  85. " 2000008: f000 e87e blx 2000108 <.*>"
  86. check thumb2_bl_out_of_range.stdout \
  87. " 2000100: e51ff004 ldr pc, \[pc, #-4\]"
  88. check thumb2_bl_out_of_range.stdout \
  89. " 2000104: 01000007 "
  90. check thumb2_bl_out_of_range.stdout \
  91. " 2000108: e51ff004 ldr pc, \[pc, #-4\]"
  92. check thumb2_bl_out_of_range.stdout \
  93. " 200010c: 0300000d "
  94. check thumb2_blx_out_of_range.stdout \
  95. " 2000004: f000 e87c blx 2000100 <.*>"
  96. check thumb2_blx_out_of_range.stdout \
  97. " 200000a: f000 e87e blx 2000108 <.*>"
  98. check thumb2_blx_out_of_range.stdout \
  99. " 2000100: e51ff004 ldr pc, \[pc, #-4\]"
  100. check thumb2_blx_out_of_range.stdout \
  101. " 2000104: 01000004 "
  102. check thumb2_blx_out_of_range.stdout \
  103. " 2000108: e51ff004 ldr pc, \[pc, #-4\]"
  104. check thumb2_blx_out_of_range.stdout \
  105. " 200010c: 0300000c "
  106. exit 0