mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-21 12:26:50 +00:00
RISCVAsmParser: Reject call foo@invalid
... instead of silently parsing and ignoring it without leaving an error message. While here, remove an unreachable `@plt`. Pull Request: https://github.com/llvm/llvm-project/pull/135509
This commit is contained in:
parent
974bda8f61
commit
c0afb77c2a
llvm
@ -2079,9 +2079,6 @@ ParseStatus RISCVAsmParser::parseBareSymbol(OperandVector &Operands) {
|
||||
|
||||
SMLoc E = SMLoc::getFromPointer(S.getPointer() + Identifier.size());
|
||||
|
||||
if (Identifier.consume_back("@plt"))
|
||||
return Error(getLoc(), "'@plt' operand not valid for instruction");
|
||||
|
||||
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
|
||||
|
||||
if (Sym->isVariable()) {
|
||||
@ -2129,8 +2126,9 @@ ParseStatus RISCVAsmParser::parseCallSymbol(OperandVector &Operands) {
|
||||
Lex();
|
||||
Lex();
|
||||
StringRef PLT;
|
||||
SMLoc Loc = getLoc();
|
||||
if (getParser().parseIdentifier(PLT) || PLT != "plt")
|
||||
return ParseStatus::Failure;
|
||||
return Error(Loc, "@ (except the deprecated/ignored @plt) is disallowed");
|
||||
} else if (!getLexer().peekTok().is(AsmToken::EndOfStatement)) {
|
||||
// Avoid parsing the register in `call rd, foo` as a call symbol.
|
||||
return ParseStatus::NoMatch;
|
||||
|
@ -10,3 +10,5 @@ call %lo(1234) # CHECK: :[[@LINE]]:6: error: operand must be a bare symbol name
|
||||
call %hi(foo) # CHECK: :[[@LINE]]:6: error: operand must be a bare symbol name
|
||||
call %lo(foo) # CHECK: :[[@LINE]]:6: error: operand must be a bare symbol name
|
||||
call foo, bar # CHECK: :[[@LINE]]:6: error: operand must be a bare symbol name
|
||||
call foo@pls # CHECK: :[[@LINE]]:10: error: @ (except the deprecated/ignored @plt) is disallowed
|
||||
call foo@3 # CHECK: :[[@LINE]]:10: error: @ (except the deprecated/ignored @plt) is disallowed
|
||||
|
@ -10,3 +10,4 @@ tail %hi(1234) # CHECK: :[[@LINE]]:6: error: operand must be a bare symbol name
|
||||
tail %lo(1234) # CHECK: :[[@LINE]]:6: error: operand must be a bare symbol name
|
||||
tail %hi(foo) # CHECK: :[[@LINE]]:6: error: operand must be a bare symbol name
|
||||
tail %lo(foo) # CHECK: :[[@LINE]]:6: error: operand must be a bare symbol name
|
||||
tail foo@pls # CHECK: :[[@LINE]]:10: error: @ (except the deprecated/ignored @plt) is disallowed
|
||||
|
Loading…
x
Reference in New Issue
Block a user