summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 646cbb43cae..939b54dd3c8 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -2485,6 +2485,9 @@ bool AsmParser::parseDirectiveReloc(SMLoc DirectiveLoc) {
if (!Offset->evaluateAsAbsolute(OffsetValue))
return Error(OffsetLoc, "expression is not a constant value");
+ if (OffsetValue < 0)
+ return Error(OffsetLoc, "expression is negative");
+
if (Lexer.isNot(AsmToken::Comma))
return TokError("expected comma");
Lexer.Lex();
OpenPOWER on IntegriCloud