thumb_bl_out_of_range.s 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # thumb_bl_out_of_range.s
  2. # Test THUMB/THUMB-2 bl instructions just out of the branch range limits.
  3. .syntax unified
  4. .section .text.pre,"x"
  5. # Add padding so that target is just output of branch range.
  6. .space 6
  7. .global _backward_target
  8. .code 16
  9. .thumb_func
  10. .type _backword_target, %function
  11. _backward_target:
  12. bx lr
  13. .size _backward_target, .-_backward_target
  14. .text
  15. # Use 256-byte alignment so that we know where the stubs start.
  16. .align 8
  17. # Define _start so that linker does not complain.
  18. .global _start
  19. .code 32
  20. .align 2
  21. .type _start, %function
  22. _start:
  23. bx lr
  24. .size _start, .-_start
  25. .global _backward_test
  26. .code 16
  27. .thumb_func
  28. .type _backward_test, %function
  29. _backward_test:
  30. bl _backward_target
  31. .size _backward_test, .-_backward_test
  32. .global _forward_test
  33. .code 16
  34. .thumb_func
  35. .type _forward_test, %function
  36. _forward_test:
  37. bl _forward_target
  38. .size _forward_test, .-_forward_test
  39. # switch back to ARM mode so that stubs are disassembled correctly.
  40. .align 2
  41. .code 32
  42. # Align stub table for address matching.
  43. .align 8
  44. .section .text.post,"x"
  45. # Add padding so that target is just out of branch range.
  46. .space 12
  47. .global _forward_target
  48. .code 16
  49. .thumb_func
  50. .type _forward_target, %function
  51. _forward_target:
  52. bx lr
  53. .size _forward_target, .-_forward_target