Remove IsExplicit. It was always false.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 9 Nov 2010 22:37:44 +0000 (22:37 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 9 Nov 2010 22:37:44 +0000 (22:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118639 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCContext.h
include/llvm/MC/MCSectionELF.h
lib/MC/ELFObjectWriter.cpp
lib/MC/MCContext.cpp
lib/MC/MCParser/ELFAsmParser.cpp
lib/MC/MCSectionELF.cpp

index 5ddbdae85d43a7d8b1a0ad4be52239274ba19b54..d3b38360e324d5f4cdcbfc9df5e340fdfecdbc34 100644 (file)
@@ -140,7 +140,6 @@ namespace llvm {
     
     const MCSection *getELFSection(StringRef Section, unsigned Type,
                                    unsigned Flags, SectionKind Kind,
-                                   bool IsExplicit = false,
                                    unsigned EntrySize = 0);
 
     const MCSection *getCOFFSection(StringRef Section, unsigned Characteristics,
index 0e4a286e72b75ebeef63563627f35d4154e4edf9..bf07b99b21a51fc4ac89d6d2c504b1100a52f164 100644 (file)
@@ -32,10 +32,6 @@ class MCSectionELF : public MCSection {
   /// below.
   unsigned Flags;
 
-  /// IsExplicit - Indicates that this section comes from globals with an
-  /// explicit section specified.
-  bool IsExplicit;
-
   /// EntrySize - The size of each entry in this section. This size only
   /// makes sense for sections that contain fixed-sized entries. If a
   /// section does not contain fixed-sized entries 'EntrySize' will be 0.
@@ -44,9 +40,9 @@ class MCSectionELF : public MCSection {
 private:
   friend class MCContext;
   MCSectionELF(StringRef Section, unsigned type, unsigned flags,
-               SectionKind K, bool isExplicit, unsigned entrySize)
+               SectionKind K, unsigned entrySize)
     : MCSection(SV_ELF, K), SectionName(Section), Type(type), Flags(flags),
-      IsExplicit(isExplicit), EntrySize(entrySize) {}
+      EntrySize(entrySize) {}
   ~MCSectionELF();
 public:
 
@@ -54,9 +50,6 @@ public:
   /// should be printed before the section name
   bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
 
-  /// ShouldPrintSectionType - Only prints the section type if supported
-  bool ShouldPrintSectionType(unsigned Ty) const;
-
   /// HasCommonSymbols - True if this section holds common symbols, this is
   /// indicated on the ELF object file by a symbol with SHN_COMMON section
   /// header index.
index a0e326db28432b8b34435669c7a40dbe7d1cfac5..313f2e20085b57984e7e35654d2dd8ed2e3074f0 100644 (file)
@@ -1065,7 +1065,7 @@ void ELFObjectWriterImpl::WriteRelocation(MCAssembler &Asm, MCAsmLayout &Layout,
     RelaSection = Ctx.getELFSection(RelaSectionName, HasRelocationAddend ?
                                     ELF::SHT_RELA : ELF::SHT_REL, 0,
                                     SectionKind::getReadOnly(),
-                                    false, EntrySize);
+                                    EntrySize);
 
     MCSectionData &RelaSD = Asm.getOrCreateSectionData(*RelaSection);
     RelaSD.setAlignment(Is64Bit ? 8 : 4);
@@ -1164,7 +1164,7 @@ void ELFObjectWriterImpl::CreateMetadataSections(MCAssembler &Asm,
   const MCSection *SymtabSection =
     Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0,
                       SectionKind::getReadOnly(),
-                      false, EntrySize);
+                      EntrySize);
   MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection);
   SymtabSD.setAlignment(Is64Bit ? 8 : 4);
   SymbolTableIndex = Asm.size();
@@ -1174,7 +1174,7 @@ void ELFObjectWriterImpl::CreateMetadataSections(MCAssembler &Asm,
   if (NeedsSymtabShndx) {
     const MCSection *SymtabShndxSection =
       Ctx.getELFSection(".symtab_shndx", ELF::SHT_SYMTAB_SHNDX, 0,
-                        SectionKind::getReadOnly(), false, 4);
+                        SectionKind::getReadOnly(), 4);
     SymtabShndxSD = &Asm.getOrCreateSectionData(*SymtabShndxSection);
     SymtabShndxSD->setAlignment(4);
   }
index 9c747d10417286961dc5ddb0eb1a897a749fc670..3b96264be043131e7d87b1c613fd87367ca6dee8 100644 (file)
@@ -151,7 +151,7 @@ getMachOSection(StringRef Segment, StringRef Section,
 
 const MCSection *MCContext::
 getELFSection(StringRef Section, unsigned Type, unsigned Flags,
-              SectionKind Kind, bool IsExplicit, unsigned EntrySize) {
+              SectionKind Kind, unsigned EntrySize) {
   if (ELFUniquingMap == 0)
     ELFUniquingMap = new ELFUniqueMapTy();
   ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
@@ -165,7 +165,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
     EntrySize = MCSectionELF::DetermineEntrySize(Kind);
   }
   MCSectionELF *Result = new (*this) MCSectionELF(Entry.getKey(), Type, Flags,
-                                                  Kind, IsExplicit, EntrySize);
+                                                  Kind, EntrySize);
   Entry.setValue(Result);
   return Result;
 }
index d6c4e451259b62f945cc8872d8a3bb583a329ec2..75eee3d44206b0d0632baba2c7e2135fba48e007 100644 (file)
@@ -331,8 +331,7 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
                      ? SectionKind::getText()
                      : SectionKind::getDataRel();
   getStreamer().SwitchSection(getContext().getELFSection(SectionName, Type,
-                                                         Flags, Kind, false,
-                                                         Size));
+                                                         Flags, Kind, Size));
   return false;
 }
 
@@ -406,7 +405,7 @@ bool ELFAsmParser::ParseDirectiveIdent(StringRef, SMLoc) {
                                MCSectionELF::SHF_MERGE |
                                MCSectionELF::SHF_STRINGS,
                                SectionKind::getReadOnly(),
-                               false, 1);
+                               1);
 
   static bool First = true;
 
index 133cad1b32cf4c3527611a6cd604f22f539df822..5bcf81021d7af8fb35d1f3e69870d625abdb3976 100644 (file)
@@ -29,14 +29,6 @@ bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,
   return false;
 }
 
-// ShouldPrintSectionType - Only prints the section type if supported
-bool MCSectionELF::ShouldPrintSectionType(unsigned Ty) const {
-  if (IsExplicit && !(Ty == SHT_NOBITS || Ty == SHT_PROGBITS))
-    return false;
-
-  return true;
-}
-
 void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
                                         raw_ostream &OS) const {
    
@@ -84,31 +76,29 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
   
   OS << '"';
 
-  if (ShouldPrintSectionType(Type)) {
-    OS << ',';
-    // If comment string is '@', e.g. as on ARM - use '%' instead
-    if (MAI.getCommentString()[0] == '@')
-      OS << '%';
-    else
-      OS << '@';
-  
-    if (Type == MCSectionELF::SHT_INIT_ARRAY)
-      OS << "init_array";
-    else if (Type == MCSectionELF::SHT_FINI_ARRAY)
-      OS << "fini_array";
-    else if (Type == MCSectionELF::SHT_PREINIT_ARRAY)
-      OS << "preinit_array";
-    else if (Type == MCSectionELF::SHT_NOBITS)
-      OS << "nobits";
-    else if (Type == MCSectionELF::SHT_PROGBITS)
-      OS << "progbits";
-  
-    if (EntrySize) {
-      OS << "," << EntrySize;
-    }
+  OS << ',';
+
+  // If comment string is '@', e.g. as on ARM - use '%' instead
+  if (MAI.getCommentString()[0] == '@')
+    OS << '%';
+  else
+    OS << '@';
+
+  if (Type == MCSectionELF::SHT_INIT_ARRAY)
+    OS << "init_array";
+  else if (Type == MCSectionELF::SHT_FINI_ARRAY)
+    OS << "fini_array";
+  else if (Type == MCSectionELF::SHT_PREINIT_ARRAY)
+    OS << "preinit_array";
+  else if (Type == MCSectionELF::SHT_NOBITS)
+    OS << "nobits";
+  else if (Type == MCSectionELF::SHT_PROGBITS)
+    OS << "progbits";
+
+  if (EntrySize) {
+    OS << "," << EntrySize;
   }
-  
+
   OS << '\n';
 }