[PATCH] D34452: Implement the ".rdata" MIPS assembly directive.

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 13:41:24 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305949: [Target] Implement the ".rdata" MIPS assembly directive. (authored by davide).

Changed prior to commit:
  https://reviews.llvm.org/D34452?vs=103382&id=103457#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34452

Files:
  llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp


Index: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -322,6 +322,7 @@
   bool parseDirectiveSet();
   bool parseDirectiveOption();
   bool parseInsnDirective();
+  bool parseRSectionDirective(StringRef Section);
   bool parseSSectionDirective(StringRef Section, unsigned Type);
 
   bool parseSetAtDirective();
@@ -6952,6 +6953,23 @@
   return false;
 }
 
+/// parseRSectionDirective
+///  ::= .rdata
+bool MipsAsmParser::parseRSectionDirective(StringRef Section) {
+  // If this is not the end of the statement, report an error.
+  if (getLexer().isNot(AsmToken::EndOfStatement)) {
+    reportParseError("unexpected token, expected end of statement");
+    return false;
+  }
+
+  MCSection *ELFSection =
+      getContext().getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
+  getParser().getStreamer().SwitchSection(ELFSection);
+
+  getParser().Lex(); // Eat EndOfStatement token.
+  return false;
+}
+
 /// parseSSectionDirective
 ///  ::= .sbss
 ///  ::= .sdata
@@ -7499,6 +7517,10 @@
     parseInsnDirective();
     return false;
   }
+  if (IDVal == ".rdata") {
+    parseRSectionDirective(".rodata");
+    return false;
+  }
   if (IDVal == ".sbss") {
     parseSSectionDirective(IDVal, ELF::SHT_NOBITS);
     return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34452.103457.patch
Type: text/x-patch
Size: 1440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170621/fecd6e18/attachment.bin>


More information about the llvm-commits mailing list