summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2013-01-18 01:25:48 +0000
committerDaniel Dunbar <daniel@zuster.org>2013-01-18 01:25:48 +0000
commit16004b832422e5493de1d54f225eaed215b0526c (patch)
treed623e4d7efac28959035675cbb1faea15c9d1858 /llvm/lib/MC/MCParser
parent4038fa3c82de858661143d3c8d129318fcbcc6f8 (diff)
downloadbcm5719-llvm-16004b832422e5493de1d54f225eaed215b0526c.tar.gz
bcm5719-llvm-16004b832422e5493de1d54f225eaed215b0526c.zip
[MC/Mach-O] Add AsmParser support for .linker_option directive.
llvm-svn: 172778
Diffstat (limited to 'llvm/lib/MC/MCParser')
-rw-r--r--llvm/lib/MC/MCParser/DarwinAsmParser.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
index 7fda7ac5e15..9029c6d0851 100644
--- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -87,6 +87,8 @@ public:
AddDirectiveHandler<
&DarwinAsmParser::ParseSectionDirectiveLazySymbolPointers>(
".lazy_symbol_pointer");
+ AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveLinkerOption>(
+ ".linker_option");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral16>(
".literal16");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral4>(
@@ -163,6 +165,7 @@ public:
bool ParseDirectiveDesc(StringRef, SMLoc);
bool ParseDirectiveDumpOrLoad(StringRef, SMLoc);
bool ParseDirectiveLsym(StringRef, SMLoc);
+ bool ParseDirectiveLinkerOption(StringRef, SMLoc);
bool ParseDirectiveSection(StringRef, SMLoc);
bool ParseDirectivePushSection(StringRef, SMLoc);
bool ParseDirectivePopSection(StringRef, SMLoc);
@@ -435,6 +438,33 @@ bool DarwinAsmParser::ParseDirectiveDumpOrLoad(StringRef Directive,
return Warning(IDLoc, "ignoring directive .load for now");
}
+/// ParseDirectiveLinkerOption
+/// ::= .linker_option "string" ( , "string" )*
+bool DarwinAsmParser::ParseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
+ SmallVector<std::string, 4> Args;
+ for (;;) {
+ if (getLexer().isNot(AsmToken::String))
+ return TokError("expected string in '" + Twine(IDVal) + "' directive");
+
+ std::string Data;
+ if (getParser().ParseEscapedString(Data))
+ return true;
+
+ Args.push_back(Data);
+
+ Lex();
+ if (getLexer().is(AsmToken::EndOfStatement))
+ break;
+
+ if (getLexer().isNot(AsmToken::Comma))
+ return TokError("unexpected token in '" + Twine(IDVal) + "' directive");
+ Lex();
+ }
+
+ getStreamer().EmitLinkerOptions(Args);
+ return false;
+}
+
/// ParseDirectiveLsym
/// ::= .lsym identifier , expression
bool DarwinAsmParser::ParseDirectiveLsym(StringRef, SMLoc) {
OpenPOWER on IntegriCloud