Remove IsExplicit. It was always false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118639 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2010-11-09 22:37:44 +00:00
parent 3a2429a86c
commit e61a1ac595
6 changed files with 31 additions and 50 deletions

View File

@ -140,7 +140,6 @@ namespace llvm {
const MCSection *getELFSection(StringRef Section, unsigned Type, const MCSection *getELFSection(StringRef Section, unsigned Type,
unsigned Flags, SectionKind Kind, unsigned Flags, SectionKind Kind,
bool IsExplicit = false,
unsigned EntrySize = 0); unsigned EntrySize = 0);
const MCSection *getCOFFSection(StringRef Section, unsigned Characteristics, const MCSection *getCOFFSection(StringRef Section, unsigned Characteristics,

View File

@ -32,10 +32,6 @@ class MCSectionELF : public MCSection {
/// below. /// below.
unsigned Flags; 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 /// EntrySize - The size of each entry in this section. This size only
/// makes sense for sections that contain fixed-sized entries. If a /// makes sense for sections that contain fixed-sized entries. If a
/// section does not contain fixed-sized entries 'EntrySize' will be 0. /// section does not contain fixed-sized entries 'EntrySize' will be 0.
@ -44,9 +40,9 @@ class MCSectionELF : public MCSection {
private: private:
friend class MCContext; friend class MCContext;
MCSectionELF(StringRef Section, unsigned type, unsigned flags, 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), : MCSection(SV_ELF, K), SectionName(Section), Type(type), Flags(flags),
IsExplicit(isExplicit), EntrySize(entrySize) {} EntrySize(entrySize) {}
~MCSectionELF(); ~MCSectionELF();
public: public:
@ -54,9 +50,6 @@ public:
/// should be printed before the section name /// should be printed before the section name
bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; 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 /// HasCommonSymbols - True if this section holds common symbols, this is
/// indicated on the ELF object file by a symbol with SHN_COMMON section /// indicated on the ELF object file by a symbol with SHN_COMMON section
/// header index. /// header index.

View File

@ -1065,7 +1065,7 @@ void ELFObjectWriterImpl::WriteRelocation(MCAssembler &Asm, MCAsmLayout &Layout,
RelaSection = Ctx.getELFSection(RelaSectionName, HasRelocationAddend ? RelaSection = Ctx.getELFSection(RelaSectionName, HasRelocationAddend ?
ELF::SHT_RELA : ELF::SHT_REL, 0, ELF::SHT_RELA : ELF::SHT_REL, 0,
SectionKind::getReadOnly(), SectionKind::getReadOnly(),
false, EntrySize); EntrySize);
MCSectionData &RelaSD = Asm.getOrCreateSectionData(*RelaSection); MCSectionData &RelaSD = Asm.getOrCreateSectionData(*RelaSection);
RelaSD.setAlignment(Is64Bit ? 8 : 4); RelaSD.setAlignment(Is64Bit ? 8 : 4);
@ -1164,7 +1164,7 @@ void ELFObjectWriterImpl::CreateMetadataSections(MCAssembler &Asm,
const MCSection *SymtabSection = const MCSection *SymtabSection =
Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0, Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0,
SectionKind::getReadOnly(), SectionKind::getReadOnly(),
false, EntrySize); EntrySize);
MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection); MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection);
SymtabSD.setAlignment(Is64Bit ? 8 : 4); SymtabSD.setAlignment(Is64Bit ? 8 : 4);
SymbolTableIndex = Asm.size(); SymbolTableIndex = Asm.size();
@ -1174,7 +1174,7 @@ void ELFObjectWriterImpl::CreateMetadataSections(MCAssembler &Asm,
if (NeedsSymtabShndx) { if (NeedsSymtabShndx) {
const MCSection *SymtabShndxSection = const MCSection *SymtabShndxSection =
Ctx.getELFSection(".symtab_shndx", ELF::SHT_SYMTAB_SHNDX, 0, Ctx.getELFSection(".symtab_shndx", ELF::SHT_SYMTAB_SHNDX, 0,
SectionKind::getReadOnly(), false, 4); SectionKind::getReadOnly(), 4);
SymtabShndxSD = &Asm.getOrCreateSectionData(*SymtabShndxSection); SymtabShndxSD = &Asm.getOrCreateSectionData(*SymtabShndxSection);
SymtabShndxSD->setAlignment(4); SymtabShndxSD->setAlignment(4);
} }

View File

@ -151,7 +151,7 @@ getMachOSection(StringRef Segment, StringRef Section,
const MCSection *MCContext:: const MCSection *MCContext::
getELFSection(StringRef Section, unsigned Type, unsigned Flags, getELFSection(StringRef Section, unsigned Type, unsigned Flags,
SectionKind Kind, bool IsExplicit, unsigned EntrySize) { SectionKind Kind, unsigned EntrySize) {
if (ELFUniquingMap == 0) if (ELFUniquingMap == 0)
ELFUniquingMap = new ELFUniqueMapTy(); ELFUniquingMap = new ELFUniqueMapTy();
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap; ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
@ -165,7 +165,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
EntrySize = MCSectionELF::DetermineEntrySize(Kind); EntrySize = MCSectionELF::DetermineEntrySize(Kind);
} }
MCSectionELF *Result = new (*this) MCSectionELF(Entry.getKey(), Type, Flags, MCSectionELF *Result = new (*this) MCSectionELF(Entry.getKey(), Type, Flags,
Kind, IsExplicit, EntrySize); Kind, EntrySize);
Entry.setValue(Result); Entry.setValue(Result);
return Result; return Result;
} }

View File

@ -331,8 +331,7 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
? SectionKind::getText() ? SectionKind::getText()
: SectionKind::getDataRel(); : SectionKind::getDataRel();
getStreamer().SwitchSection(getContext().getELFSection(SectionName, Type, getStreamer().SwitchSection(getContext().getELFSection(SectionName, Type,
Flags, Kind, false, Flags, Kind, Size));
Size));
return false; return false;
} }
@ -406,7 +405,7 @@ bool ELFAsmParser::ParseDirectiveIdent(StringRef, SMLoc) {
MCSectionELF::SHF_MERGE | MCSectionELF::SHF_MERGE |
MCSectionELF::SHF_STRINGS, MCSectionELF::SHF_STRINGS,
SectionKind::getReadOnly(), SectionKind::getReadOnly(),
false, 1); 1);
static bool First = true; static bool First = true;

View File

@ -29,14 +29,6 @@ bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,
return false; 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, void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const { raw_ostream &OS) const {
@ -84,31 +76,29 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
OS << '"'; OS << '"';
if (ShouldPrintSectionType(Type)) { OS << ',';
OS << ',';
// If comment string is '@', e.g. as on ARM - use '%' instead
// If comment string is '@', e.g. as on ARM - use '%' instead if (MAI.getCommentString()[0] == '@')
if (MAI.getCommentString()[0] == '@') OS << '%';
OS << '%'; else
else OS << '@';
OS << '@';
if (Type == MCSectionELF::SHT_INIT_ARRAY)
if (Type == MCSectionELF::SHT_INIT_ARRAY) OS << "init_array";
OS << "init_array"; else if (Type == MCSectionELF::SHT_FINI_ARRAY)
else if (Type == MCSectionELF::SHT_FINI_ARRAY) OS << "fini_array";
OS << "fini_array"; else if (Type == MCSectionELF::SHT_PREINIT_ARRAY)
else if (Type == MCSectionELF::SHT_PREINIT_ARRAY) OS << "preinit_array";
OS << "preinit_array"; else if (Type == MCSectionELF::SHT_NOBITS)
else if (Type == MCSectionELF::SHT_NOBITS) OS << "nobits";
OS << "nobits"; else if (Type == MCSectionELF::SHT_PROGBITS)
else if (Type == MCSectionELF::SHT_PROGBITS) OS << "progbits";
OS << "progbits";
if (EntrySize) {
if (EntrySize) { OS << "," << EntrySize;
OS << "," << EntrySize;
}
} }
OS << '\n'; OS << '\n';
} }