Add support for assigning to . in AsmParser.

This is implemented by handling assignments to the '.' pseudo symbol
as ".org" directives.

Differential Revision: http://llvm-reviews.chandlerc.com/D2625



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201530 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anders Waldenborg
2014-02-17 20:48:32 +00:00
parent 3457506fb9
commit 1410f7ffc6
6 changed files with 81 additions and 12 deletions

View File

@@ -2119,12 +2119,6 @@ bool AsmParser::parseAssignment(StringRef Name, bool allow_redef,
if (Lexer.isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in assignment");
// Error on assignment to '.'.
if (Name == ".") {
return Error(EqualLoc, ("assignment to pseudo-symbol '.' is unsupported "
"(use '.space' or '.org').)"));
}
// Eat the end of statement marker.
Lex();
@@ -2152,11 +2146,15 @@ bool AsmParser::parseAssignment(StringRef Name, bool allow_redef,
// Don't count these checks as uses.
Sym->setUsed(false);
} else if (Name == ".") {
if (Out.EmitValueToOffset(Value, 0)) {
Error(EqualLoc, "expected absolute expression");
eatToEndOfStatement();
}
return false;
} else
Sym = getContext().GetOrCreateSymbol(Name);
// FIXME: Handle '.'.
// Do the assignment.
Out.EmitAssignment(Sym, Value);
if (NoDeadStrip)