Skip to content

Commit 840e3b0

Browse files
committed
AArch64: Reject label difference with a relocation specifier in generic assembler code
... instead of within AArch64ELFObjectWriter. Aligns with other targets.
1 parent 839916c commit 840e3b0

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static bool evaluate(const MCSpecifierExpr &Expr, MCValue &Res,
124124
if (!Expr.getSubExpr()->evaluateAsRelocatable(Res, Asm))
125125
return false;
126126
Res.setSpecifier(Expr.getSpecifier());
127-
return true;
127+
return !Res.getSubSym();
128128
}
129129

130130
AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin(bool IsILP32) {

llvm/test/MC/AArch64/error-location.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: 1-byte data relocations not supported
2323
.byte undef-.
2424

25-
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
25+
// CHECK: :[[@LINE+1]]:16: error: expected relocatable expression
2626
ldr x0, [x1, :lo12:undef-.]
2727

2828
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: invalid fixup for 8-bit load/store instruction

llvm/test/MC/AArch64/label-arithmetic-diags-elf.s

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,14 @@ negative:
4949
// CHECK-NEXT: ^
5050

5151
add w0, w1, #:lo12:external - end
52-
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
52+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected relocatable expression
5353
// CHECK-NEXT: add w0, w1, #:lo12:external - end
54-
// CHECK-NEXT: ^
5554

5655
cmp w0, #:lo12:external - end
57-
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
58-
// CHECK-NEXT: cmp w0, #:lo12:external - end
59-
// CHECK-NEXT: ^
56+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected relocatable expression
6057

6158
add w0, w1, #:got_lo12:external - end
62-
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
63-
// CHECK-NEXT: add w0, w1, #:got_lo12:external - end
64-
// CHECK-NEXT: ^
65-
66-
cmp w0, #:got_lo12:external - end
67-
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Unsupported pc-relative fixup kind
68-
// CHECK-NEXT: cmp w0, #:got_lo12:external - end
69-
// CHECK-NEXT: ^
59+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected relocatable expression
7060

7161
.section sec_y
7262
end_across_sec:

0 commit comments

Comments
 (0)