Commit | Line | Data |
---|---|---|
a2c7281b DK |
1 | # thumb_blx_out_of_range.s |
2 | # Test THUMB/THUMB-2 blx instructions just out of the branch range limits. | |
3 | .syntax unified | |
4 | ||
5 | .section .text.pre,"x" | |
6 | ||
7 | # Add padding so that target is just output of branch range. | |
8 | .space 6 | |
9 | ||
10 | .global _forward_target | |
11 | .global _backward_target | |
12 | .type _backword_target, %function | |
13 | _backward_target: | |
14 | bx lr | |
15 | .size _backward_target, .-_backward_target | |
16 | ||
17 | .text | |
18 | ||
19 | # Define _start so that linker does not complain. | |
20 | .align 2 | |
21 | .global _start | |
22 | .code 32 | |
23 | .type _start, %function | |
24 | _start: | |
25 | bx lr | |
26 | .size _start, .-_start | |
27 | ||
28 | .global _backward_test | |
29 | .code 16 | |
30 | .thumb_func | |
31 | .type _backward_test, %function | |
32 | _backward_test: | |
33 | bl _backward_target | |
34 | .size _backward_test, .-_backward_test | |
35 | ||
36 | .align 2 | |
37 | .global _forward_test | |
38 | .code 16 | |
39 | .thumb_func | |
40 | .type _forward_test, %function | |
41 | _forward_test: | |
42 | # Bit 1 of the BLX target comes from bit 1 of branch base address, | |
43 | # which is BLX instruction's address + 4. We intentionally put this | |
44 | # forward BLX at an address n*4 + 2 so that the branch offset is | |
45 | # bumped up by 2. | |
46 | nop.n | |
47 | bl _forward_target | |
48 | .size _forward_test, .-_forward_test | |
49 | .code 32 | |
50 | ||
51 | .section .text.post,"x" | |
52 | ||
53 | # Add padding so that target is just out of branch range. | |
54 | .space 12 | |
55 | .align 2 | |
56 | .code 32 | |
57 | .global _forward_target | |
58 | .type _forward_target, %function | |
59 | _forward_target: | |
60 | bx lr | |
61 | .size _forward_target, .-_forward_target |