diff options
author | Kevin Enderby <enderby@apple.com> | 2009-07-14 21:35:03 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2009-07-14 21:35:03 +0000 |
commit | 711482476c55f99c34c516f9e035b7c59b00ef42 (patch) | |
tree | dde0a4d27bc9fbd9f5c3b641b02e1939de61d024 /tools/llvm-mc/AsmParser.cpp | |
parent | 4cb73525a943d69da0f2b0c31c1a1d7f3cdd879d (diff) | |
download | llvm-711482476c55f99c34c516f9e035b7c59b00ef42.tar.gz llvm-711482476c55f99c34c516f9e035b7c59b00ef42.tar.bz2 llvm-711482476c55f99c34c516f9e035b7c59b00ef42.tar.xz |
Added llvm-mc support for parsing the .lsym directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75685 91177308-0d34-0410-b5e6-96231b3b80d8
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 d94b7b3270..b4e0f5792a 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; +} |