[llvm-commits] [llvm] r118699 - in /llvm/trunk: include/llvm/MC/MCContext.h lib/MC/ELFObjectWriter.cpp lib/MC/MCContext.cpp

Rafael Espindola rafael.espindola at gmail.com
Wed Nov 10 11:05:08 PST 2010


Author: rafael
Date: Wed Nov 10 13:05:07 2010
New Revision: 118699

URL: http://llvm.org/viewvc/llvm-project?rev=118699&view=rev
Log:
Use MCSectionELF in places we know we have an ELF section.

Modified:
    llvm/trunk/include/llvm/MC/MCContext.h
    llvm/trunk/lib/MC/ELFObjectWriter.cpp
    llvm/trunk/lib/MC/MCContext.cpp

Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=118699&r1=118698&r2=118699&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Wed Nov 10 13:05:07 2010
@@ -30,6 +30,7 @@
   class StringRef;
   class Twine;
   class MCSectionMachO;
+  class MCSectionELF;
 
   /// MCContext - Context object for machine code objects.  This class owns all
   /// of the sections that it creates.
@@ -138,9 +139,9 @@
       return getMachOSection(Segment, Section, TypeAndAttributes, 0, K);
     }
     
-    const MCSection *getELFSection(StringRef Section, unsigned Type,
-                                   unsigned Flags, SectionKind Kind,
-                                   unsigned EntrySize = 0);
+    const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
+                                      unsigned Flags, SectionKind Kind,
+                                      unsigned EntrySize = 0);
 
     const MCSection *getCOFFSection(StringRef Section, unsigned Characteristics,
                                     int Selection, SectionKind Kind);

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=118699&r1=118698&r2=118699&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed Nov 10 13:05:07 2010
@@ -1048,7 +1048,7 @@
                                           const MCSectionData &SD) {
   if (!Relocations[&SD].empty()) {
     MCContext &Ctx = Asm.getContext();
-    const MCSection *RelaSection;
+    const MCSectionELF *RelaSection;
     const MCSectionELF &Section =
       static_cast<const MCSectionELF&>(SD.getSection());
 
@@ -1154,14 +1154,14 @@
   unsigned NumRegularSections = Asm.size();
 
   // We construct .shstrtab, .symtab and .strtab in this order to match gnu as.
-  const MCSection *ShstrtabSection =
+  const MCSectionELF *ShstrtabSection =
     Ctx.getELFSection(".shstrtab", ELF::SHT_STRTAB, 0,
                       SectionKind::getReadOnly(), false);
   MCSectionData &ShstrtabSD = Asm.getOrCreateSectionData(*ShstrtabSection);
   ShstrtabSD.setAlignment(1);
   ShstrtabIndex = Asm.size();
 
-  const MCSection *SymtabSection =
+  const MCSectionELF *SymtabSection =
     Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0,
                       SectionKind::getReadOnly(),
                       EntrySize);
@@ -1172,7 +1172,7 @@
   MCSectionData *SymtabShndxSD = NULL;
 
   if (NeedsSymtabShndx) {
-    const MCSection *SymtabShndxSection =
+    const MCSectionELF *SymtabShndxSection =
       Ctx.getELFSection(".symtab_shndx", ELF::SHT_SYMTAB_SHNDX, 0,
                         SectionKind::getReadOnly(), 4);
     SymtabShndxSD = &Asm.getOrCreateSectionData(*SymtabShndxSection);
@@ -1350,8 +1350,8 @@
 
     case ELF::SHT_REL:
     case ELF::SHT_RELA: {
-      const MCSection *SymtabSection;
-      const MCSection *InfoSection;
+      const MCSectionELF *SymtabSection;
+      const MCSectionELF *InfoSection;
 
       SymtabSection = Asm.getContext().getELFSection(".symtab", ELF::SHT_SYMTAB, 0,
                                                      SectionKind::getReadOnly(),

Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=118699&r1=118698&r2=118699&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Wed Nov 10 13:05:07 2010
@@ -148,8 +148,7 @@
                                             Reserved2, Kind);
 }
 
-
-const MCSection *MCContext::
+const MCSectionELF *MCContext::
 getELFSection(StringRef Section, unsigned Type, unsigned Flags,
               SectionKind Kind, unsigned EntrySize) {
   if (ELFUniquingMap == 0)





More information about the llvm-commits mailing list