summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-04-30 21:10:06 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-04-30 21:10:06 +0000
commitb186391e2d1a693347859ada0bf180e74a7b0ad9 (patch)
tree14e6fd80da9303d823ba234336cb1e902100ad48 /llvm/lib/MC/ELFObjectWriter.cpp
parent26c0a5ea0db90030c0fefe206fbb3800b8db4486 (diff)
downloadbcm5719-llvm-b186391e2d1a693347859ada0bf180e74a7b0ad9.tar.gz
bcm5719-llvm-b186391e2d1a693347859ada0bf180e74a7b0ad9.zip
Don't create a MCSectionData when we don't have to.
llvm-svn: 236260
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 98d6c77698a..2ace9843a77 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -226,8 +226,8 @@ class ELFObjectWriter : public MCObjectWriter {
void CompressDebugSections(MCAssembler &Asm, MCAsmLayout &Layout);
- const MCSectionELF *createSectionHeaderStringTable(MCAssembler &Asm);
- const MCSectionELF *createStringTable(MCAssembler &Asm);
+ const MCSectionELF *createSectionHeaderStringTable();
+ const MCSectionELF *createStringTable(MCContext &Ctx);
void ExecutePostLayoutBinding(MCAssembler &Asm,
const MCAsmLayout &Layout) override;
@@ -1308,20 +1308,16 @@ void ELFObjectWriter::writeRelocations(const MCAssembler &Asm,
}
}
-const MCSectionELF *
-ELFObjectWriter::createSectionHeaderStringTable(MCAssembler &Asm) {
+const MCSectionELF *ELFObjectWriter::createSectionHeaderStringTable() {
const MCSectionELF *ShstrtabSection = SectionTable[ShstrtabIndex - 1];
- Asm.getOrCreateSectionData(*ShstrtabSection);
ShStrTabBuilder.finalize(StringTableBuilder::ELF);
OS << ShStrTabBuilder.data();
return ShstrtabSection;
}
-const MCSectionELF *ELFObjectWriter::createStringTable(MCAssembler &Asm) {
- MCContext &Ctx = Asm.getContext();
+const MCSectionELF *ELFObjectWriter::createStringTable(MCContext &Ctx) {
const MCSectionELF *StrtabSection =
Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0);
- Asm.getOrCreateSectionData(*StrtabSection);
StringTableIndex = addToSectionTable(StrtabSection);
OS << StrTabBuilder.data();
return StrtabSection;
@@ -1384,7 +1380,7 @@ void ELFObjectWriter::writeSectionHeader(
MCAssembler &Asm, const MCAsmLayout &Layout,
const SectionIndexMapTy &SectionIndexMap,
const SectionOffsetsTy &SectionOffsets) {
- const unsigned NumSections = Asm.size();
+ const unsigned NumSections = SectionTable.size();
// Null section first.
uint64_t FirstSectionSize =
@@ -1497,14 +1493,14 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
{
uint64_t SecStart = OS.tell();
- const MCSectionELF *Sec = createStringTable(Asm);
+ const MCSectionELF *Sec = createStringTable(Ctx);
uint64_t SecEnd = OS.tell();
SectionOffsets[Sec] = std::make_pair(SecStart, SecEnd);
}
{
uint64_t SecStart = OS.tell();
- const MCSectionELF *Sec = createSectionHeaderStringTable(Asm);
+ const MCSectionELF *Sec = createSectionHeaderStringTable();
uint64_t SecEnd = OS.tell();
SectionOffsets[Sec] = std::make_pair(SecStart, SecEnd);
}
OpenPOWER on IntegriCloud