Use MCSectionELF in places we know we have an ELF section.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 10 Nov 2010 19:05:07 +0000 (19:05 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 10 Nov 2010 19:05:07 +0000 (19:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118699 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCContext.h
lib/MC/ELFObjectWriter.cpp
lib/MC/MCContext.cpp

index d3b38360e324d5f4cdcbfc9df5e340fdfecdbc34..417fe040d19caf2f297b9a61ef7f578d0e0c29df 100644 (file)
@@ -30,6 +30,7 @@ namespace llvm {
   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 @@ namespace llvm {
       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);
index 313f2e20085b57984e7e35654d2dd8ed2e3074f0..ec7091f7a01b58501548a7a51e2851d2b804d5cf 100644 (file)
@@ -1048,7 +1048,7 @@ void ELFObjectWriterImpl::WriteRelocation(MCAssembler &Asm, MCAsmLayout &Layout,
                                           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 @@ void ELFObjectWriterImpl::CreateMetadataSections(MCAssembler &Asm,
   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 @@ void ELFObjectWriterImpl::CreateMetadataSections(MCAssembler &Asm,
   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 @@ void ELFObjectWriterImpl::WriteObject(MCAssembler &Asm,
 
     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(),
index 3b96264be043131e7d87b1c613fd87367ca6dee8..bafa10a174ab98d43707f8f544b5e9d2ba02234b 100644 (file)
@@ -148,8 +148,7 @@ getMachOSection(StringRef Segment, StringRef Section,
                                             Reserved2, Kind);
 }
 
-
-const MCSection *MCContext::
+const MCSectionELF *MCContext::
 getELFSection(StringRef Section, unsigned Type, unsigned Flags,
               SectionKind Kind, unsigned EntrySize) {
   if (ELFUniquingMap == 0)