Automatic date update in version.in
[binutils-gdb.git] / gold / testsuite / thumb_blx_out_of_range.s
blob2dfbf06b6319d85914bd209e39bbe4ad15b9e2fa
1 # thumb_blx_out_of_range.s
2 # Test THUMB/THUMB-2 blx instructions just out of the branch range limits.
3 .syntax unified
5 .section .text.pre,"x"
7 # Add padding so that target is just output of branch range.
8 .space 4
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
17 .text
18 # Use 256-byte alignment so that we know where the stubs start.
19 .align 8
21 # Define _start so that linker does not complain.
22 .align 2
23 .global _start
24 .code 32
25 .type _start, %function
26 _start:
27 bx lr
28 .size _start, .-_start
30 .global _backward_test
31 .code 16
32 .thumb_func
33 .type _backward_test, %function
34 _backward_test:
35 bl _backward_target
36 .size _backward_test, .-_backward_test
38 .align 2
39 .global _forward_test
40 .code 16
41 .thumb_func
42 .type _forward_test, %function
43 _forward_test:
44 # Bit 1 of the BLX target comes from bit 1 of branch base address,
45 # which is BLX instruction's address + 4. We intentionally put this
46 # forward BLX at an address n*4 + 2 so that the branch offset is
47 # bumped up by 2.
48 nop.n
49 bl _forward_target
50 .size _forward_test, .-_forward_test
52 # switch back to ARM mode so that stubs are disassembled correctly.
53 .align 2
54 .code 32
56 # Align stub table for address matching.
57 .align 8
59 .section .text.post,"x"
61 # Add padding so that target is just out of branch range.
62 .space 12
63 .align 2
64 .code 32
65 .global _forward_target
66 .type _forward_target, %function
67 _forward_target:
68 bx lr
69 .size _forward_target, .-_forward_target