mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
[mips] [IAS] Fix using .cpsetup with local labels (PR22518).
Summary: Parse for an MCExpr instead of an Identifier and use the symbol for relocations, not just the symbol's name. This fixes errors when using local labels in .cpsetup (PR22518). Reviewers: dsanders Reviewed By: dsanders Subscribers: seanbruno, emaste, llvm-commits Differential Revision: http://reviews.llvm.org/D7697 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229671 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3781,12 +3781,20 @@ bool MipsAsmParser::parseDirectiveCPSetup() {
|
||||
if (!eatComma("unexpected token, expected comma"))
|
||||
return true;
|
||||
|
||||
StringRef Name;
|
||||
if (Parser.parseIdentifier(Name))
|
||||
reportParseError("expected identifier");
|
||||
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
|
||||
const MCExpr *Expr;
|
||||
if (Parser.parseExpression(Expr)) {
|
||||
reportParseError("expected expression");
|
||||
return false;
|
||||
}
|
||||
|
||||
getTargetStreamer().emitDirectiveCpsetup(FuncReg, Save, *Sym, SaveIsReg);
|
||||
if (Expr->getKind() != MCExpr::SymbolRef) {
|
||||
reportParseError("expected symbol");
|
||||
return false;
|
||||
}
|
||||
const MCSymbolRefExpr *Ref = static_cast<const MCSymbolRefExpr *>(Expr);
|
||||
|
||||
getTargetStreamer().emitDirectiveCpsetup(FuncReg, Save, Ref->getSymbol(),
|
||||
SaveIsReg);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user