git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207414
91177308-0d34-0410-b5e6-
96231b3b80d8
MCValue Value;
if (!Expr->EvaluateAsRelocatable(Value, &Layout))
llvm_unreachable("Invalid Expression");
- assert(!Value.getSymB());
+ const MCSymbolRefExpr *RefB = Value.getSymB();
+ if (RefB) {
+ Layout.getAssembler().getContext().FatalError(
+ SMLoc(), Twine("symbol '") + RefB->getSymbol().getName() +
+ "' could not be evaluated in a subtraction expression");
+ }
const MCSymbolRefExpr *A = Value.getSymA();
if (!A)
return nullptr;
--- /dev/null
+// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux < %s 2>&1 | FileCheck %s
+
+a:
+ .section foo
+b:
+c = b - a
+
+; CHECK: symbol 'a' could not be evaluated in a subtraction expression