mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 07:31:47 +00:00
Remove redundant temporary std::vector.
New sections are added to the end of the list, so the RelSections array was redundant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236053 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9f7d13868a
commit
b89275550c
@ -239,8 +239,7 @@ class ELFObjectWriter : public MCObjectWriter {
|
|||||||
SectionIndexMapTy &SectionIndexMap,
|
SectionIndexMapTy &SectionIndexMap,
|
||||||
const RevGroupMapTy &RevGroupMap);
|
const RevGroupMapTy &RevGroupMap);
|
||||||
|
|
||||||
MCSectionData *createRelocationSection(MCAssembler &Asm,
|
void createRelocationSection(MCAssembler &Asm, const MCSectionData &SD);
|
||||||
const MCSectionData &SD);
|
|
||||||
|
|
||||||
void CompressDebugSections(MCAssembler &Asm, MCAsmLayout &Layout);
|
void CompressDebugSections(MCAssembler &Asm, MCAsmLayout &Layout);
|
||||||
|
|
||||||
@ -957,32 +956,16 @@ void ELFObjectWriter::maybeAddToGroup(MCAssembler &Asm,
|
|||||||
void ELFObjectWriter::computeIndexMap(
|
void ELFObjectWriter::computeIndexMap(
|
||||||
MCAssembler &Asm, std::vector<const MCSectionELF *> &Sections,
|
MCAssembler &Asm, std::vector<const MCSectionELF *> &Sections,
|
||||||
SectionIndexMapTy &SectionIndexMap, const RevGroupMapTy &RevGroupMap) {
|
SectionIndexMapTy &SectionIndexMap, const RevGroupMapTy &RevGroupMap) {
|
||||||
std::vector<const MCSectionELF *> RelSections;
|
|
||||||
for (const MCSectionData &SD : Asm) {
|
for (const MCSectionData &SD : Asm) {
|
||||||
const MCSectionELF &Section =
|
const MCSectionELF &Section =
|
||||||
static_cast<const MCSectionELF &>(SD.getSection());
|
static_cast<const MCSectionELF &>(SD.getSection());
|
||||||
if (Section.getType() == ELF::SHT_GROUP ||
|
if (Section.getType() == ELF::SHT_GROUP)
|
||||||
Section.getType() == ELF::SHT_REL ||
|
|
||||||
Section.getType() == ELF::SHT_RELA)
|
|
||||||
continue;
|
continue;
|
||||||
Sections.push_back(&Section);
|
Sections.push_back(&Section);
|
||||||
unsigned Index = Sections.size();
|
unsigned Index = Sections.size();
|
||||||
SectionIndexMap[&Section] = Index;
|
SectionIndexMap[&Section] = Index;
|
||||||
maybeAddToGroup(Asm, RevGroupMap, Section, Index);
|
maybeAddToGroup(Asm, RevGroupMap, Section, Index);
|
||||||
|
createRelocationSection(Asm, SD);
|
||||||
if (MCSectionData *RelSD = createRelocationSection(Asm, SD)) {
|
|
||||||
const MCSectionELF *RelSection =
|
|
||||||
static_cast<const MCSectionELF *>(&RelSD->getSection());
|
|
||||||
RelSections.push_back(RelSection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put relocation sections close together. The linker reads them
|
|
||||||
// first, so this improves cache locality.
|
|
||||||
for (const MCSectionELF *Sec : RelSections) {
|
|
||||||
Sections.push_back(Sec);
|
|
||||||
unsigned Index = Sections.size();
|
|
||||||
maybeAddToGroup(Asm, RevGroupMap, *Sec, Index);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1131,11 +1114,10 @@ void ELFObjectWriter::computeSymbolTable(
|
|||||||
UndefinedSymbolData[i].SymbolData->setIndex(Index++);
|
UndefinedSymbolData[i].SymbolData->setIndex(Index++);
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSectionData *
|
void ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
|
||||||
ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
|
const MCSectionData &SD) {
|
||||||
const MCSectionData &SD) {
|
|
||||||
if (Relocations[&SD].empty())
|
if (Relocations[&SD].empty())
|
||||||
return nullptr;
|
return;
|
||||||
|
|
||||||
MCContext &Ctx = Asm.getContext();
|
MCContext &Ctx = Asm.getContext();
|
||||||
const MCSectionELF &Section =
|
const MCSectionELF &Section =
|
||||||
@ -1158,7 +1140,7 @@ ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
|
|||||||
const MCSectionELF *RelaSection = Ctx.createELFRelSection(
|
const MCSectionELF *RelaSection = Ctx.createELFRelSection(
|
||||||
RelaSectionName, hasRelocationAddend() ? ELF::SHT_RELA : ELF::SHT_REL,
|
RelaSectionName, hasRelocationAddend() ? ELF::SHT_RELA : ELF::SHT_REL,
|
||||||
Flags, EntrySize, Section.getGroup(), &Section);
|
Flags, EntrySize, Section.getGroup(), &Section);
|
||||||
return &Asm.getOrCreateSectionData(*RelaSection);
|
Asm.getOrCreateSectionData(*RelaSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SmallVector<char, 128>
|
static SmallVector<char, 128>
|
||||||
|
Loading…
Reference in New Issue
Block a user