diff options
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r-- | tools/llvm-mc/AsmParser.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp index d94b7b3..b4e0f57 100644 --- a/tools/llvm-mc/AsmParser.cpp +++ b/tools/llvm-mc/AsmParser.cpp @@ -528,6 +528,8 @@ bool AsmParser::ParseStatement() { return ParseDirectiveDarwinZerofill(); if (!strcmp(IDVal, ".desc")) return ParseDirectiveDarwinSymbolDesc(); + if (!strcmp(IDVal, ".lsym")) + return ParseDirectiveDarwinLsym(); if (!strcmp(IDVal, ".subsections_via_symbols")) return ParseDirectiveDarwinSubsectionsViaSymbols(); @@ -1126,3 +1128,33 @@ bool AsmParser::ParseDirectiveAbort() { return false; } + +/// ParseDirectiveLsym +/// ::= .lsym identifier , expression +bool AsmParser::ParseDirectiveDarwinLsym() { + if (Lexer.isNot(asmtok::Identifier)) + return TokError("expected identifier in directive"); + + // handle the identifier as the key symbol. + SMLoc IDLoc = Lexer.getLoc(); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + Lexer.Lex(); + + if (Lexer.isNot(asmtok::Comma)) + return TokError("unexpected token in '.lsym' directive"); + Lexer.Lex(); + + MCValue Expr; + if (ParseRelocatableExpression(Expr)) + return true; + + if (Lexer.isNot(asmtok::EndOfStatement)) + return TokError("unexpected token in '.lsym' directive"); + + Lexer.Lex(); + + // Create the Sym with the value of the Expr + Out.EmitLocalSymbol(Sym, Expr); + + return false; +} |