@@ -322,6 +322,7 @@ class MipsAsmParser : public MCTargetAsmParser {
322322 bool parseDirectiveSet ();
323323 bool parseDirectiveOption ();
324324 bool parseInsnDirective ();
325+ bool parseRSectionDirective (StringRef Section);
325326 bool parseSSectionDirective (StringRef Section, unsigned Type);
326327
327328 bool parseSetAtDirective ();
@@ -6952,6 +6953,23 @@ bool MipsAsmParser::parseInsnDirective() {
69526953 return false ;
69536954}
69546955
6956+ // / parseRSectionDirective
6957+ // / ::= .rdata
6958+ bool MipsAsmParser::parseRSectionDirective (StringRef Section) {
6959+ // If this is not the end of the statement, report an error.
6960+ if (getLexer ().isNot (AsmToken::EndOfStatement)) {
6961+ reportParseError (" unexpected token, expected end of statement" );
6962+ return false ;
6963+ }
6964+
6965+ MCSection *ELFSection =
6966+ getContext ().getELFSection (Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
6967+ getParser ().getStreamer ().SwitchSection (ELFSection);
6968+
6969+ getParser ().Lex (); // Eat EndOfStatement token.
6970+ return false ;
6971+ }
6972+
69556973// / parseSSectionDirective
69566974// / ::= .sbss
69576975// / ::= .sdata
@@ -7499,6 +7517,10 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
74997517 parseInsnDirective ();
75007518 return false ;
75017519 }
7520+ if (IDVal == " .rdata" ) {
7521+ parseRSectionDirective (" .rodata" );
7522+ return false ;
7523+ }
75027524 if (IDVal == " .sbss" ) {
75037525 parseSSectionDirective (IDVal, ELF::SHT_NOBITS);
75047526 return false ;
0 commit comments