File: thumb2-branch-ranges.s

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (102 lines) | stat: -rw-r--r-- 2,425 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
@ RUN: not llvm-mc %s -triple thumbv7-linux-gnueabi -filetype=obj -o /dev/null 2>&1 | FileCheck %s

// Thumb2 unconditional branch has a range of +- 16 Megabytes. The
// conditional branch has a range of +- 1 Megabyte. We should give
// an error message if we evaluate the expression at assembly
// time and it is out of range.

        .syntax unified
        .thumb
        b.w end
        .space 0xfffffe
end:
        b.w end2
        .space 0xfffffe
        .global end2
end2:

// branch to arm function uses relocation
        b.w end3
        .space 0x1000000
        .global end3
        .type end3, %function
        .arm
end3:   bx lr
        .thumb

// branch to thumb function is resolved at assembly time
// CHECK-NOT: error
// CHECK: [[@LINE+2]]:{{[0-9]}}: error: Relocation out of range
// CHECK-LABEL: b.w end4
        b.w end4
        .space 0x1000000
        .thumb_func
end4:

        beq.w end5
        .space 0xffffc
end5:

// conditional branch to arm function uses relocation
        beq.w end6
        .arm
        .type end6, %function
        .space 0x100000
end6:   bx lr
        .thumb

// conditional branch to thumb function resolved at assembly time
// CHECK-NOT: error
// CHECK: [[@LINE+2]]:{{[0-9]}}: error: Relocation out of range
// CHECK-LABEL: beq.w end7
        beq.w end7
        .space 0x100000
end7:

start:
        .space 0xfffffc
        b.w start

        .arm
        .global start2
        .type start2, %function
start2:
        .space 0x1000000
        .thumb
// branch to arm function uses relocation
        b.w start2

start3:
        .space 0x1000000
// branch to thumb function resolved at assembly time
// CHECK-NOT: error
// CHECK: [[@LINE+2]]:{{[0-9]}}: error: Relocation out of range
// CHECK-LABEL: b.w start3
        b.w start3

start4:
        .space 0xffffc
        b.w start4

        .arm
        .global start5
        .type start5, %function
start5:
        .space 0x100000
        .thumb
// conditional branch to arm function uses relocation
        beq.w start5

start6:
        .space 0x100000
// branch to thumb function resolved at assembly time
// CHECK-NOT: error
// CHECK: [[@LINE+2]]:{{[0-9]}}: error: Relocation out of range
// CHECK-LABEL: beq.w start6
        beq.w start6

start7:
// branch to thumb function resolved at assembly time
// CHECK: [[#@LINE+1]]:{{[0-9]}}: error: Relocation out of range
        b.w start8 - start7 + 0x1000000
start8: