Upload Tizen:Base source
[external/binutils.git] / gold / testsuite / thumb_blx_out_of_range.s
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  4
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 # Use 256-byte alignment so that we know where the stubs start.
19         .align  8
20
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
29
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
37
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
51
52 # switch back to ARM mode so that stubs are disassembled correctly.
53         .code   32
54         nop
55         
56         .section        .text.post,"x"
57
58 # Add padding so that target is just out of branch range. 
59         .space  12
60         .align 2
61         .code   32
62         .global _forward_target
63         .type   _forward_target, %function
64 _forward_target:
65         bx      lr
66         .size   _forward_target, .-_forward_target