summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index e8b34d56f5b..12b5f595ca4 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -606,7 +606,12 @@ static const MCSymbol *getBaseSymbol(const MCAsmLayout &Layout,
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;
OpenPOWER on IntegriCloud