summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-04-28 21:07:28 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-04-28 21:07:28 +0000
commit55a3afb418d283b92f5b3bdf4413ae25682c5de6 (patch)
tree9043f90c5e9df5bd90c4d86541444a8bdc5bbd7a /llvm/lib
parent1e1728536a4a453c81fad90d94b3b3c0f9dd5897 (diff)
downloadbcm5719-llvm-55a3afb418d283b92f5b3bdf4413ae25682c5de6.tar.gz
bcm5719-llvm-55a3afb418d283b92f5b3bdf4413ae25682c5de6.zip
Remove the GroupMapTy DenseMap. NFC.
Instead use the Group symbol of MCSectionELF. llvm-svn: 236033
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp28
-rw-r--r--llvm/lib/MC/MCContext.cpp4
2 files changed, 12 insertions, 20 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index aaca625082d..21ddf4c1ab7 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -217,8 +217,6 @@ class ELFObjectWriter : public MCObjectWriter {
uint64_t getSymbolIndexInSymbolTable(const MCAssembler &Asm,
const MCSymbol *S);
- // Map from a group section to the signature symbol
- typedef DenseMap<const MCSectionELF*, const MCSymbol*> GroupMapTy;
// Map from a signature symbol to the group section
typedef DenseMap<const MCSymbol*, const MCSectionELF*> RevGroupMapTy;
// Start and end offset of each section
@@ -248,15 +246,14 @@ class ELFObjectWriter : public MCObjectWriter {
// 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,
- GroupMapTy &GroupMap, RevGroupMapTy &RevGroupMap,
+ RevGroupMapTy &RevGroupMap,
SectionIndexMapTy &SectionIndexMap);
void ExecutePostLayoutBinding(MCAssembler &Asm,
const MCAsmLayout &Layout) override;
void writeSectionHeader(ArrayRef<const MCSectionELF *> Sections,
- MCAssembler &Asm, const GroupMapTy &GroupMap,
- const MCAsmLayout &Layout,
+ MCAssembler &Asm, const MCAsmLayout &Layout,
const SectionIndexMapTy &SectionIndexMap,
const SectionOffsetsTy &SectionOffsets);
@@ -1422,8 +1419,8 @@ void ELFObjectWriter::CreateMetadataSections(
}
void ELFObjectWriter::createIndexedSections(
- MCAssembler &Asm, MCAsmLayout &Layout, GroupMapTy &GroupMap,
- RevGroupMapTy &RevGroupMap, SectionIndexMapTy &SectionIndexMap) {
+ MCAssembler &Asm, MCAsmLayout &Layout, RevGroupMapTy &RevGroupMap,
+ SectionIndexMapTy &SectionIndexMap) {
MCContext &Ctx = Asm.getContext();
// Build the groups
@@ -1438,13 +1435,12 @@ void ELFObjectWriter::createIndexedSections(
Asm.getOrCreateSymbolData(*SignatureSymbol);
const MCSectionELF *&Group = RevGroupMap[SignatureSymbol];
if (!Group) {
- Group = Ctx.CreateELFGroupSection();
+ Group = Ctx.createELFGroupSection(SignatureSymbol);
MCSectionData &Data = Asm.getOrCreateSectionData(*Group);
Data.setAlignment(4);
MCDataFragment *F = new MCDataFragment(&Data);
write(*F, uint32_t(ELF::GRP_COMDAT));
}
- GroupMap[Group] = SignatureSymbol;
}
computeIndexMap(Asm, SectionIndexMap);
@@ -1540,8 +1536,7 @@ void ELFObjectWriter::writeDataSectionData(MCAssembler &Asm,
void ELFObjectWriter::writeSectionHeader(
ArrayRef<const MCSectionELF *> Sections, MCAssembler &Asm,
- const GroupMapTy &GroupMap, const MCAsmLayout &Layout,
- const SectionIndexMapTy &SectionIndexMap,
+ const MCAsmLayout &Layout, const SectionIndexMapTy &SectionIndexMap,
const SectionOffsetsTy &SectionOffsets) {
const unsigned NumSections = Asm.size();
@@ -1559,8 +1554,7 @@ void ELFObjectWriter::writeSectionHeader(
if (Section.getType() != ELF::SHT_GROUP)
GroupSymbolIndex = 0;
else
- GroupSymbolIndex = getSymbolIndexInSymbolTable(Asm,
- GroupMap.lookup(&Section));
+ GroupSymbolIndex = getSymbolIndexInSymbolTable(Asm, Section.getGroup());
const std::pair<uint64_t, uint64_t> &Offsets = SectionOffsets[i];
uint64_t Size = Section.getType() == ELF::SHT_NOBITS
@@ -1574,13 +1568,12 @@ void ELFObjectWriter::writeSectionHeader(
void ELFObjectWriter::WriteObject(MCAssembler &Asm,
const MCAsmLayout &Layout) {
- GroupMapTy GroupMap;
RevGroupMapTy RevGroupMap;
SectionIndexMapTy SectionIndexMap;
CompressDebugSections(Asm, const_cast<MCAsmLayout &>(Layout));
- createIndexedSections(Asm, const_cast<MCAsmLayout &>(Layout), GroupMap,
- RevGroupMap, SectionIndexMap);
+ createIndexedSections(Asm, const_cast<MCAsmLayout &>(Layout), RevGroupMap,
+ SectionIndexMap);
// Compute symbol table information.
computeSymbolTable(Asm, Layout, SectionIndexMap, RevGroupMap);
@@ -1621,8 +1614,7 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
const unsigned SectionHeaderOffset = OS.tell();
// ... then the section header table ...
- writeSectionHeader(Sections, Asm, GroupMap, Layout, SectionIndexMap,
- SectionOffsets);
+ writeSectionHeader(Sections, Asm, Layout, SectionIndexMap, SectionOffsets);
if (is64Bit()) {
uint64_t Val = SectionHeaderOffset;
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 5f8e3c11de3..fd0422daf29 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -337,10 +337,10 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
return Result;
}
-const MCSectionELF *MCContext::CreateELFGroupSection() {
+const MCSectionELF *MCContext::createELFGroupSection(const MCSymbol *Group) {
MCSectionELF *Result = new (*this)
MCSectionELF(".group", ELF::SHT_GROUP, 0, SectionKind::getReadOnly(), 4,
- nullptr, ~0, nullptr, nullptr);
+ Group, ~0, nullptr, nullptr);
return Result;
}
OpenPOWER on IntegriCloud