1// RUN: not llvm-mc -triple aarch64-elf -filetype=obj %s -o /dev/null 2>&1 | FileCheck %s
2
3  .data
4b:
5  .fill 300
6e:
7  .byte e - b
8  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: value evaluated as 300 is out of range.
9  // CHECK-NEXT: .byte e - b
10  // CHECK-NEXT:       ^
11
12  .section sec_x
13start:
14  .space 5000
15end:
16  add w0, w1, #(end - start)
17  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: fixup value out of range
18  // CHECK-NEXT: add w0, w1, #(end - start)
19  // CHECK-NEXT: ^
20
21  cmp w0, #(end - start)
22  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: fixup value out of range
23  // CHECK-NEXT: cmp w0, #(end - start)
24  // CHECK-NEXT: ^
25
26negative:
27  add w0, w1, #(end - negative)
28  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: fixup value out of range
29  // CHECK-NEXT: add w0, w1, #(end - negative)
30  // CHECK-NEXT: ^
31
32  cmp w0, #(end - negative)
33  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: fixup value out of range
34  // CHECK-NEXT: cmp w0, #(end - negative)
35  // CHECK-NEXT: ^
36
37  add w0, w1, #(end - external)
38  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: symbol 'external' can not be undefined in a subtraction expression
39  // CHECK-NEXT: add w0, w1, #(end - external)
40  // CHECK-NEXT: ^
41
42  cmp w0, #(end - external)
43  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: symbol 'external' can not be undefined in a subtraction expression
44  // CHECK-NEXT: cmp w0, #(end - external)
45  // CHECK-NEXT: ^
46
47  add w0, w1, #:lo12:external - end
48  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
49  // CHECK-NEXT: add w0, w1, #:lo12:external - end
50  // CHECK-NEXT: ^
51
52  cmp w0, #:lo12:external - end
53  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
54  // CHECK-NEXT: cmp w0, #:lo12:external - end
55  // CHECK-NEXT: ^
56
57  add w0, w1, #:got_lo12:external - end
58  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
59  // CHECK-NEXT: add w0, w1, #:got_lo12:external - end
60  // CHECK-NEXT: ^
61
62  cmp w0, #:got_lo12:external - end
63  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
64  // CHECK-NEXT: cmp w0, #:got_lo12:external - end
65  // CHECK-NEXT: ^
66
67  .section sec_y
68end_across_sec:
69  add w0, w1, #(end_across_sec - start)
70  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Cannot represent a difference across sections
71  // CHECK-NEXT: add w0, w1, #(end_across_sec - start)
72  // CHECK-NEXT: ^
73
74  cmp w0, #(end_across_sec - start)
75  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Cannot represent a difference across sections
76  // CHECK-NEXT: cmp w0, #(end_across_sec - start)
77  // CHECK-NEXT: ^
78
79  add w0, w1, #(sec_y - sec_x)
80  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Cannot represent a difference across sections
81  // CHECK-NEXT: add w0, w1, #(sec_y - sec_x)
82  // CHECK-NEXT: ^
83
84  cmp w0, #(sec_y - sec_x)
85  // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Cannot represent a difference across sections
86  // CHECK-NEXT: cmp w0, #(sec_y - sec_x)
87  // CHECK-NEXT: ^
88