Skip to content

Commit 75ed943

Browse files
committed
[Target] Implement the ".rdata" MIPS assembly directive.
Patch by John Baldwin < jhb at freebsd dot org >! Differential Revision: https://reviews.llvm.org/D34452 llvm-svn: 305949
1 parent 9b8e3d3 commit 75ed943

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)