mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
MC: Move ParseDirectiveELFType into ELFAsmParser. COFF uses .type for something else.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116142 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -983,8 +983,6 @@ bool AsmParser::ParseStatement() {
|
||||
return ParseDirectiveSymbolAttribute(MCSA_Protected);
|
||||
if (IDVal == ".reference")
|
||||
return ParseDirectiveSymbolAttribute(MCSA_Reference);
|
||||
if (IDVal == ".type")
|
||||
return ParseDirectiveELFType();
|
||||
if (IDVal == ".weak")
|
||||
return ParseDirectiveSymbolAttribute(MCSA_Weak);
|
||||
if (IDVal == ".weak_definition")
|
||||
@@ -1701,52 +1699,6 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCSymbolAttr Attr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseDirectiveELFType
|
||||
/// ::= .type identifier , @attribute
|
||||
bool AsmParser::ParseDirectiveELFType() {
|
||||
StringRef Name;
|
||||
if (ParseIdentifier(Name))
|
||||
return TokError("expected identifier in directive");
|
||||
|
||||
// Handle the identifier as the key symbol.
|
||||
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
|
||||
|
||||
if (getLexer().isNot(AsmToken::Comma))
|
||||
return TokError("unexpected token in '.type' directive");
|
||||
Lex();
|
||||
|
||||
if (getLexer().isNot(AsmToken::At))
|
||||
return TokError("expected '@' before type");
|
||||
Lex();
|
||||
|
||||
StringRef Type;
|
||||
SMLoc TypeLoc;
|
||||
|
||||
TypeLoc = getLexer().getLoc();
|
||||
if (ParseIdentifier(Type))
|
||||
return TokError("expected symbol type in directive");
|
||||
|
||||
MCSymbolAttr Attr = StringSwitch<MCSymbolAttr>(Type)
|
||||
.Case("function", MCSA_ELF_TypeFunction)
|
||||
.Case("object", MCSA_ELF_TypeObject)
|
||||
.Case("tls_object", MCSA_ELF_TypeTLS)
|
||||
.Case("common", MCSA_ELF_TypeCommon)
|
||||
.Case("notype", MCSA_ELF_TypeNoType)
|
||||
.Default(MCSA_Invalid);
|
||||
|
||||
if (Attr == MCSA_Invalid)
|
||||
return Error(TypeLoc, "unsupported attribute in '.type' directive");
|
||||
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement))
|
||||
return TokError("unexpected token in '.type' directive");
|
||||
|
||||
Lex();
|
||||
|
||||
getStreamer().EmitSymbolAttribute(Sym, Attr);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseDirectiveComm
|
||||
/// ::= ( .comm | .lcomm ) identifier , size_expression [ , align_expression ]
|
||||
bool AsmParser::ParseDirectiveComm(bool IsLocal) {
|
||||
|
Reference in New Issue
Block a user