[llvm] r229080 - Revert a series of commits starting at r228886 which is triggering some
Chandler Carruth
chandlerc at gmail.com
Thu Feb 12 23:52:39 PST 2015
Author: chandlerc
Date: Fri Feb 13 01:52:39 2015
New Revision: 229080
URL: http://llvm.org/viewvc/llvm-project?rev=229080&view=rev
Log:
Revert a series of commits starting at r228886 which is triggering some
regressions for LLDB on Linux. Rafael indicated on lldb-dev that we
should just go ahead and revert these but that he wasn't at a computer.
The patches backed out are as follows:
r228980: Add support for having multiple sections with the name and ...
r228889: Invert the section relocation map.
r228888: Use the existing SymbolTableIndex intsead of doing a lookup.
r228886: Create the Section -> Rel Section map when it is first needed.
These patches look pretty nice to me, so hoping its not too hard to get
them re-instated. =D
Removed:
llvm/trunk/test/CodeGen/X86/non-unique-sections.ll
llvm/trunk/test/MC/ELF/section-unique.s
Modified:
llvm/trunk/include/llvm/CodeGen/CommandFlags.h
llvm/trunk/include/llvm/MC/MCContext.h
llvm/trunk/include/llvm/MC/MCSectionELF.h
llvm/trunk/include/llvm/Target/TargetMachine.h
llvm/trunk/include/llvm/Target/TargetOptions.h
llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/MCContext.cpp
llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
llvm/trunk/lib/MC/MCSectionELF.cpp
Modified: llvm/trunk/include/llvm/CodeGen/CommandFlags.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CommandFlags.h?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/CommandFlags.h (original)
+++ llvm/trunk/include/llvm/CodeGen/CommandFlags.h Fri Feb 13 01:52:39 2015
@@ -207,10 +207,6 @@ FunctionSections("function-sections",
cl::desc("Emit functions into separate sections"),
cl::init(false));
-cl::opt<bool> UniqueSectionNames("unique-section-names",
- cl::desc("Give unique names to every section"),
- cl::init(true));
-
cl::opt<llvm::JumpTable::JumpTableType>
JTableType("jump-table-type",
cl::desc("Choose the type of Jump-Instruction Table for jumptable."),
@@ -288,7 +284,6 @@ static inline TargetOptions InitTargetOp
Options.UseInitArray = !UseCtors;
Options.DataSections = DataSections;
Options.FunctionSections = FunctionSections;
- Options.UniqueSectionNames = UniqueSectionNames;
Options.MCOptions = InitMCTargetOptionsFromFlags();
Options.JTType = JTableType;
Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Fri Feb 13 01:52:39 2015
@@ -277,10 +277,6 @@ namespace llvm {
unsigned Flags, unsigned EntrySize,
StringRef Group);
- const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
- unsigned Flags, unsigned EntrySize,
- StringRef Group, bool Unique);
-
void renameELFSection(const MCSectionELF *Section, StringRef Name);
const MCSectionELF *CreateELFGroupSection();
Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionELF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionELF.h Fri Feb 13 01:52:39 2015
@@ -39,8 +39,6 @@ class MCSectionELF : public MCSection {
/// below.
unsigned Flags;
- bool Unique;
-
/// 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.
@@ -50,10 +48,10 @@ class MCSectionELF : public MCSection {
private:
friend class MCContext;
- MCSectionELF(StringRef Section, unsigned type, unsigned flags, SectionKind K,
- unsigned entrySize, const MCSymbol *group, bool Unique)
- : MCSection(SV_ELF, K), SectionName(Section), Type(type), Flags(flags),
- Unique(Unique), EntrySize(entrySize), Group(group) {}
+ MCSectionELF(StringRef Section, unsigned type, unsigned flags,
+ SectionKind K, unsigned entrySize, const MCSymbol *group)
+ : MCSection(SV_ELF, K), SectionName(Section), Type(type), Flags(flags),
+ EntrySize(entrySize), Group(group) {}
~MCSectionELF();
void setSectionName(StringRef Name) { SectionName = Name; }
Modified: llvm/trunk/include/llvm/Target/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetMachine.h (original)
+++ llvm/trunk/include/llvm/Target/TargetMachine.h Fri Feb 13 01:52:39 2015
@@ -171,8 +171,6 @@ public:
return Options.MCOptions.AsmVerbose;
}
- bool getUniqueSectionNames() const { return Options.UniqueSectionNames; }
-
/// Return true if data objects should be emitted into their own section,
/// corresponds to -fdata-sections.
bool getDataSections() const {
Modified: llvm/trunk/include/llvm/Target/TargetOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetOptions.h (original)
+++ llvm/trunk/include/llvm/Target/TargetOptions.h Fri Feb 13 01:52:39 2015
@@ -78,8 +78,8 @@ namespace llvm {
EnableFastISel(false), PositionIndependentExecutable(false),
UseInitArray(false), DisableIntegratedAS(false),
CompressDebugSections(false), FunctionSections(false),
- DataSections(false), UniqueSectionNames(true), TrapUnreachable(false),
- TrapFuncName(), FloatABIType(FloatABI::Default),
+ DataSections(false), TrapUnreachable(false), TrapFuncName(),
+ FloatABIType(FloatABI::Default),
AllowFPOpFusion(FPOpFusion::Standard), JTType(JumpTable::Single),
FCFI(false), ThreadModel(ThreadModel::POSIX),
CFIType(CFIntegrity::Sub), CFIEnforcing(false), CFIFuncName() {}
@@ -198,8 +198,6 @@ namespace llvm {
/// Emit data into separate sections.
unsigned DataSections : 1;
- unsigned UniqueSectionNames : 1;
-
/// Emit target-specific trap instruction for 'unreachable' IR instructions.
unsigned TrapUnreachable : 1;
Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Fri Feb 13 01:52:39 2015
@@ -228,25 +228,25 @@ const MCSection *TargetLoweringObjectFil
/// DataSections.
static StringRef getSectionPrefixForGlobal(SectionKind Kind) {
if (Kind.isText())
- return ".text";
+ return ".text.";
if (Kind.isReadOnly())
- return ".rodata";
+ return ".rodata.";
if (Kind.isBSS())
- return ".bss";
+ return ".bss.";
if (Kind.isThreadData())
- return ".tdata";
+ return ".tdata.";
if (Kind.isThreadBSS())
- return ".tbss";
+ return ".tbss.";
if (Kind.isDataNoRel())
- return ".data";
+ return ".data.";
if (Kind.isDataRelLocal())
- return ".data.rel.local";
+ return ".data.rel.local.";
if (Kind.isDataRel())
- return ".data.rel";
+ return ".data.rel.";
if (Kind.isReadOnlyWithRelLocal())
- return ".data.rel.ro.local";
+ return ".data.rel.ro.local.";
assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
- return ".data.rel.ro";
+ return ".data.rel.ro.";
}
const MCSection *TargetLoweringObjectFileELF::
@@ -268,19 +268,16 @@ SelectSectionForGlobal(const GlobalValue
StringRef Prefix = getSectionPrefixForGlobal(Kind);
SmallString<128> Name(Prefix);
- bool UniqueSectionNames = TM.getUniqueSectionNames();
- if (UniqueSectionNames) {
- Name.push_back('.');
- TM.getNameWithPrefix(Name, GV, Mang, true);
- }
+ TM.getNameWithPrefix(Name, GV, Mang, true);
+
StringRef Group = "";
if (const Comdat *C = getELFComdat(GV)) {
Flags |= ELF::SHF_GROUP;
Group = C->getName();
}
- return getContext().getELFSection(Name, getELFSectionType(Name, Kind),
- Flags, 0, Group, !UniqueSectionNames);
+ return getContext().getELFSection(
+ Name.str(), getELFSectionType(Name.str(), Kind), Flags, 0, Group);
}
if (Kind.isText()) return TextSection;
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Fri Feb 13 01:52:39 2015
@@ -247,12 +247,11 @@ class ELFObjectWriter : public MCObjectW
const RevGroupMapTy &RevGroupMap,
unsigned NumRegularSections);
- void computeIndexMap(MCAssembler &Asm,
+ void ComputeIndexMap(MCAssembler &Asm,
SectionIndexMapTy &SectionIndexMap,
- RelMapTy &RelMap);
+ const RelMapTy &RelMap);
- MCSectionData *createRelocationSection(MCAssembler &Asm,
- const MCSectionData &SD);
+ void CreateRelocationSections(MCAssembler &Asm, RelMapTy &RelMap);
void CompressDebugSections(MCAssembler &Asm, MCAsmLayout &Layout);
@@ -264,19 +263,18 @@ class ELFObjectWriter : public MCObjectW
// Create the sections that show up in the symbol table. Currently
// those are the .note.GNU-stack section and the group sections.
- void createIndexedSections(MCAssembler &Asm, MCAsmLayout &Layout,
+ void CreateIndexedSections(MCAssembler &Asm, MCAsmLayout &Layout,
GroupMapTy &GroupMap,
RevGroupMapTy &RevGroupMap,
SectionIndexMapTy &SectionIndexMap,
- RelMapTy &RelMap);
+ const RelMapTy &RelMap);
void ExecutePostLayoutBinding(MCAssembler &Asm,
const MCAsmLayout &Layout) override;
- void writeSectionHeader(MCAssembler &Asm, const GroupMapTy &GroupMap,
+ void WriteSectionHeader(MCAssembler &Asm, const GroupMapTy &GroupMap,
const MCAsmLayout &Layout,
const SectionIndexMapTy &SectionIndexMap,
- const RelMapTy &RelMap,
const SectionOffsetMapTy &SectionOffsetMap);
void ComputeSectionOrder(MCAssembler &Asm,
@@ -299,9 +297,8 @@ class ELFObjectWriter : public MCObjectW
bool IsPCRel) const override;
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
- void writeSection(MCAssembler &Asm,
+ void WriteSection(MCAssembler &Asm,
const SectionIndexMapTy &SectionIndexMap,
- const RelMapTy &RelMap,
uint32_t GroupSymbolIndex,
uint64_t Offset, uint64_t Size, uint64_t Alignment,
const MCSectionELF &Section);
@@ -944,9 +941,9 @@ bool ELFObjectWriter::isLocal(const MCSy
return true;
}
-void ELFObjectWriter::computeIndexMap(MCAssembler &Asm,
+void ELFObjectWriter::ComputeIndexMap(MCAssembler &Asm,
SectionIndexMapTy &SectionIndexMap,
- RelMapTy &RelMap) {
+ const RelMapTy &RelMap) {
unsigned Index = 1;
for (MCAssembler::iterator it = Asm.begin(),
ie = Asm.end(); it != ie; ++it) {
@@ -959,20 +956,16 @@ void ELFObjectWriter::computeIndexMap(MC
for (MCAssembler::iterator it = Asm.begin(),
ie = Asm.end(); it != ie; ++it) {
- const MCSectionData &SD = *it;
const MCSectionELF &Section =
- static_cast<const MCSectionELF &>(SD.getSection());
+ static_cast<const MCSectionELF &>(it->getSection());
if (Section.getType() == ELF::SHT_GROUP ||
Section.getType() == ELF::SHT_REL ||
Section.getType() == ELF::SHT_RELA)
continue;
SectionIndexMap[&Section] = Index++;
- if (MCSectionData *RelSD = createRelocationSection(Asm, SD)) {
- const MCSectionELF *RelSection =
- static_cast<const MCSectionELF *>(&RelSD->getSection());
- RelMap[RelSection] = &Section;
+ const MCSectionELF *RelSection = RelMap.lookup(&Section);
+ if (RelSection)
SectionIndexMap[RelSection] = Index++;
- }
}
}
@@ -1122,37 +1115,42 @@ ELFObjectWriter::computeSymbolTable(MCAs
UndefinedSymbolData[i].SymbolData->setIndex(Index++);
}
-MCSectionData *
-ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
- const MCSectionData &SD) {
- if (Relocations[&SD].empty())
- return nullptr;
+void ELFObjectWriter::CreateRelocationSections(MCAssembler &Asm,
+ RelMapTy &RelMap) {
+ for (MCAssembler::const_iterator it = Asm.begin(),
+ ie = Asm.end(); it != ie; ++it) {
+ const MCSectionData &SD = *it;
+ if (Relocations[&SD].empty())
+ continue;
- MCContext &Ctx = Asm.getContext();
- const MCSectionELF &Section =
- static_cast<const MCSectionELF &>(SD.getSection());
+ MCContext &Ctx = Asm.getContext();
+ const MCSectionELF &Section =
+ static_cast<const MCSectionELF&>(SD.getSection());
- const StringRef SectionName = Section.getSectionName();
- std::string RelaSectionName = hasRelocationAddend() ? ".rela" : ".rel";
- RelaSectionName += SectionName;
-
- unsigned EntrySize;
- if (hasRelocationAddend())
- EntrySize = is64Bit() ? sizeof(ELF::Elf64_Rela) : sizeof(ELF::Elf32_Rela);
- else
- EntrySize = is64Bit() ? sizeof(ELF::Elf64_Rel) : sizeof(ELF::Elf32_Rel);
+ const StringRef SectionName = Section.getSectionName();
+ std::string RelaSectionName = hasRelocationAddend() ? ".rela" : ".rel";
+ RelaSectionName += SectionName;
+
+ unsigned EntrySize;
+ if (hasRelocationAddend())
+ EntrySize = is64Bit() ? sizeof(ELF::Elf64_Rela) : sizeof(ELF::Elf32_Rela);
+ else
+ EntrySize = is64Bit() ? sizeof(ELF::Elf64_Rel) : sizeof(ELF::Elf32_Rel);
- unsigned Flags = 0;
- StringRef Group = "";
- if (Section.getFlags() & ELF::SHF_GROUP) {
- Flags = ELF::SHF_GROUP;
- Group = Section.getGroup()->getName();
- }
+ unsigned Flags = 0;
+ StringRef Group = "";
+ if (Section.getFlags() & ELF::SHF_GROUP) {
+ Flags = ELF::SHF_GROUP;
+ Group = Section.getGroup()->getName();
+ }
- const MCSectionELF *RelaSection = Ctx.getELFSection(
- RelaSectionName, hasRelocationAddend() ? ELF::SHT_RELA : ELF::SHT_REL,
- Flags, EntrySize, Group, true);
- return &Asm.getOrCreateSectionData(*RelaSection);
+ const MCSectionELF *RelaSection =
+ Ctx.getELFSection(RelaSectionName, hasRelocationAddend() ?
+ ELF::SHT_RELA : ELF::SHT_REL, Flags,
+ EntrySize, Group);
+ RelMap[&Section] = RelaSection;
+ Asm.getOrCreateSectionData(*RelaSection);
+ }
}
static SmallVector<char, 128>
@@ -1302,21 +1300,20 @@ void ELFObjectWriter::CompressDebugSecti
void ELFObjectWriter::WriteRelocations(MCAssembler &Asm, MCAsmLayout &Layout,
const RelMapTy &RelMap) {
- for (MCAssembler::iterator it = Asm.begin(), ie = Asm.end(); it != ie; ++it) {
- MCSectionData &RelSD = *it;
- const MCSectionELF &RelSection =
- static_cast<const MCSectionELF &>(RelSD.getSection());
+ for (MCAssembler::const_iterator it = Asm.begin(),
+ ie = Asm.end(); it != ie; ++it) {
+ const MCSectionData &SD = *it;
+ const MCSectionELF &Section =
+ static_cast<const MCSectionELF&>(SD.getSection());
- unsigned Type = RelSection.getType();
- if (Type != ELF::SHT_REL && Type != ELF::SHT_RELA)
+ const MCSectionELF *RelaSection = RelMap.lookup(&Section);
+ if (!RelaSection)
continue;
+ MCSectionData &RelaSD = Asm.getOrCreateSectionData(*RelaSection);
+ RelaSD.setAlignment(is64Bit() ? 8 : 4);
- const MCSectionELF *Section = RelMap.lookup(&RelSection);
- MCSectionData &SD = Asm.getOrCreateSectionData(*Section);
- RelSD.setAlignment(is64Bit() ? 8 : 4);
-
- MCDataFragment *F = new MCDataFragment(&RelSD);
- WriteRelocationsFragment(Asm, F, &SD);
+ MCDataFragment *F = new MCDataFragment(&RelaSD);
+ WriteRelocationsFragment(Asm, F, &*it);
}
}
@@ -1448,12 +1445,12 @@ void ELFObjectWriter::CreateMetadataSect
ShStrTabBuilder.data().end());
}
-void ELFObjectWriter::createIndexedSections(MCAssembler &Asm,
+void ELFObjectWriter::CreateIndexedSections(MCAssembler &Asm,
MCAsmLayout &Layout,
GroupMapTy &GroupMap,
RevGroupMapTy &RevGroupMap,
SectionIndexMapTy &SectionIndexMap,
- RelMapTy &RelMap) {
+ const RelMapTy &RelMap) {
MCContext &Ctx = Asm.getContext();
// Build the groups
@@ -1477,7 +1474,7 @@ void ELFObjectWriter::createIndexedSecti
GroupMap[Group] = SignatureSymbol;
}
- computeIndexMap(Asm, SectionIndexMap, RelMap);
+ ComputeIndexMap(Asm, SectionIndexMap, RelMap);
// Add sections to the groups
for (MCAssembler::const_iterator it = Asm.begin(), ie = Asm.end();
@@ -1495,9 +1492,8 @@ void ELFObjectWriter::createIndexedSecti
}
}
-void ELFObjectWriter::writeSection(MCAssembler &Asm,
+void ELFObjectWriter::WriteSection(MCAssembler &Asm,
const SectionIndexMapTy &SectionIndexMap,
- const RelMapTy &RelMap,
uint32_t GroupSymbolIndex,
uint64_t Offset, uint64_t Size,
uint64_t Alignment,
@@ -1513,9 +1509,21 @@ void ELFObjectWriter::writeSection(MCAss
case ELF::SHT_REL:
case ELF::SHT_RELA: {
- sh_link = SymbolTableIndex;
+ const MCSectionELF *SymtabSection;
+ const MCSectionELF *InfoSection;
+ SymtabSection =
+ Asm.getContext().getELFSection(".symtab", ELF::SHT_SYMTAB, 0);
+ sh_link = SectionIndexMap.lookup(SymtabSection);
assert(sh_link && ".symtab not found");
- const MCSectionELF *InfoSection = RelMap.find(&Section)->second;
+
+ // Remove ".rel" and ".rela" prefixes.
+ unsigned SecNameLen = (Section.getType() == ELF::SHT_REL) ? 4 : 5;
+ StringRef SectionName = Section.getSectionName().substr(SecNameLen);
+ StringRef GroupName =
+ Section.getGroup() ? Section.getGroup()->getName() : "";
+
+ InfoSection = Asm.getContext().getELFSection(SectionName, ELF::SHT_PROGBITS,
+ 0, 0, GroupName);
sh_info = SectionIndexMap.lookup(InfoSection);
break;
}
@@ -1626,10 +1634,11 @@ void ELFObjectWriter::WriteDataSectionDa
}
}
-void ELFObjectWriter::writeSectionHeader(
- MCAssembler &Asm, const GroupMapTy &GroupMap, const MCAsmLayout &Layout,
- const SectionIndexMapTy &SectionIndexMap, const RelMapTy &RelMap,
- const SectionOffsetMapTy &SectionOffsetMap) {
+void ELFObjectWriter::WriteSectionHeader(MCAssembler &Asm,
+ const GroupMapTy &GroupMap,
+ const MCAsmLayout &Layout,
+ const SectionIndexMapTy &SectionIndexMap,
+ const SectionOffsetMapTy &SectionOffsetMap) {
const unsigned NumSections = Asm.size() + 1;
std::vector<const MCSectionELF*> Sections;
@@ -1660,7 +1669,7 @@ void ELFObjectWriter::writeSectionHeader
uint64_t Size = GetSectionAddressSize(Layout, SD);
- writeSection(Asm, SectionIndexMap, RelMap, GroupSymbolIndex,
+ WriteSection(Asm, SectionIndexMap, GroupSymbolIndex,
SectionOffsetMap.lookup(&Section), Size,
SD.getAlignment(), Section);
}
@@ -1707,8 +1716,10 @@ void ELFObjectWriter::WriteObject(MCAsse
CompressDebugSections(Asm, const_cast<MCAsmLayout &>(Layout));
DenseMap<const MCSectionELF*, const MCSectionELF*> RelMap;
+ CreateRelocationSections(Asm, RelMap);
+
const unsigned NumUserAndRelocSections = Asm.size();
- createIndexedSections(Asm, const_cast<MCAsmLayout&>(Layout), GroupMap,
+ CreateIndexedSections(Asm, const_cast<MCAsmLayout&>(Layout), GroupMap,
RevGroupMap, SectionIndexMap, RelMap);
const unsigned AllSections = Asm.size();
const unsigned NumIndexedSections = AllSections - NumUserAndRelocSections;
@@ -1780,7 +1791,7 @@ void ELFObjectWriter::WriteObject(MCAsse
WriteZeros(Padding);
// ... then the section header table ...
- writeSectionHeader(Asm, GroupMap, Layout, SectionIndexMap, RelMap,
+ WriteSectionHeader(Asm, GroupMap, Layout, SectionIndexMap,
SectionOffsetMap);
// ... and then the remaining sections ...
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Fri Feb 13 01:52:39 2015
@@ -272,13 +272,12 @@ void MCContext::renameELFSection(const M
const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
unsigned Flags, unsigned EntrySize,
- StringRef Group, bool Unique) {
+ StringRef Group) {
// Do the lookup, if we have a hit, return it.
auto IterBool = ELFUniquingMap.insert(
std::make_pair(SectionGroupPair(Section, Group), nullptr));
auto &Entry = *IterBool.first;
- if (!IterBool.second && !Unique)
- return Entry.second;
+ if (!IterBool.second) return Entry.second;
MCSymbol *GroupSym = nullptr;
if (!Group.empty())
@@ -293,22 +292,15 @@ const MCSectionELF *MCContext::getELFSec
Kind = SectionKind::getReadOnly();
MCSectionELF *Result = new (*this)
- MCSectionELF(CachedName, Type, Flags, Kind, EntrySize, GroupSym, Unique);
- if (!Unique)
- Entry.second = Result;
+ MCSectionELF(CachedName, Type, Flags, Kind, EntrySize, GroupSym);
+ Entry.second = Result;
return Result;
}
-const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
- unsigned Flags, unsigned EntrySize,
- StringRef Group) {
- return getELFSection(Section, Type, Flags, EntrySize, Group, false);
-}
-
const MCSectionELF *MCContext::CreateELFGroupSection() {
MCSectionELF *Result =
- new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0,
- SectionKind::getReadOnly(), 4, nullptr, false);
+ new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0,
+ SectionKind::getReadOnly(), 4, nullptr);
return Result;
}
Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Fri Feb 13 01:52:39 2015
@@ -378,8 +378,6 @@ bool ELFAsmParser::ParseSectionArguments
unsigned Flags = 0;
const MCExpr *Subsection = nullptr;
bool UseLastGroup = false;
- StringRef UniqueStr;
- bool Unique = false;
// Set the defaults first.
if (SectionName == ".fini" || SectionName == ".init" ||
@@ -464,14 +462,6 @@ bool ELFAsmParser::ParseSectionArguments
return TokError("Linkage must be 'comdat'");
}
}
- if (getLexer().is(AsmToken::Comma)) {
- Lex();
- if (getParser().parseIdentifier(UniqueStr))
- return TokError("expected identifier in directive");
- if (UniqueStr != "unique")
- return TokError("expected 'unique'");
- Unique = true;
- }
}
}
@@ -519,8 +509,8 @@ EndStmt:
}
}
- const MCSection *ELFSection = getContext().getELFSection(
- SectionName, Type, Flags, Size, GroupName, Unique);
+ const MCSection *ELFSection =
+ getContext().getELFSection(SectionName, Type, Flags, Size, GroupName);
getStreamer().SwitchSection(ELFSection, Subsection);
if (getContext().getGenDwarfForAssembly()) {
Modified: llvm/trunk/lib/MC/MCSectionELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=229080&r1=229079&r2=229080&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionELF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionELF.cpp Fri Feb 13 01:52:39 2015
@@ -24,9 +24,6 @@ MCSectionELF::~MCSectionELF() {} // anch
bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,
const MCAsmInfo &MAI) const {
- if (Unique)
- return false;
-
// FIXME: Does .section .bss/.data/.text work everywhere??
if (Name == ".text" || Name == ".data" ||
(Name == ".bss" && !MAI.usesELFSectionDirectiveForBSS()))
@@ -147,10 +144,6 @@ void MCSectionELF::PrintSwitchToSection(
printName(OS, Group->getName());
OS << ",comdat";
}
-
- if (Unique)
- OS << ",unique";
-
OS << '\n';
if (Subsection)
Removed: llvm/trunk/test/CodeGen/X86/non-unique-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/non-unique-sections.ll?rev=229079&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/non-unique-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/non-unique-sections.ll (removed)
@@ -1,15 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -unique-section-names=false | FileCheck %s
-
-; CHECK: .section .text,"ax", at progbits,unique
-; CHECK-NOT: section
-; CHECK: f:
-define void @f() {
- ret void
-}
-
-; CHECK: .section .text,"ax", at progbits,unique
-; CHECK-NOT: section
-; CHECK: g:
-define void @g() {
- ret void
-}
Removed: llvm/trunk/test/MC/ELF/section-unique.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/section-unique.s?rev=229079&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/section-unique.s (original)
+++ llvm/trunk/test/MC/ELF/section-unique.s (removed)
@@ -1,39 +0,0 @@
-// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
-// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -t | FileCheck %s --check-prefix=OBJ
-
- .section .text,"ax", at progbits,unique
- .globl f
-f:
- nop
-
- .section .text,"ax", at progbits,unique
- .globl g
-g:
- nop
-
-// test that f and g are in different sections.
-
-// CHECK: .section .text,"ax", at progbits,unique
-// CHECK: f:
-
-// CHECK: .section .text,"ax", at progbits,unique
-// CHECK: g:
-
-// OBJ: Symbol {
-// OBJ: Name: f
-// OBJ: Value: 0x0
-// OBJ: Size: 0
-// OBJ: Binding: Global
-// OBJ: Type: None
-// OBJ: Other: 0
-// OBJ: Section: .text (0x4)
-// OBJ: }
-// OBJ: Symbol {
-// OBJ: Name: g
-// OBJ: Value: 0x0
-// OBJ: Size: 0
-// OBJ: Binding: Global
-// OBJ: Type: None
-// OBJ: Other: 0
-// OBJ: Section: .text (0x5)
-// OBJ: }
More information about the llvm-commits
mailing list