forked from OSchip/llvm-project
Split .eh_frame sections in parellel.
We can now split them in the same spot we split merge sections. llvm-svn: 331064
This commit is contained in:
parent
fbff2fafb3
commit
f1652d4c60
|
|
@ -1304,7 +1304,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
|
||||||
// Do size optimizations: garbage collection, merging of SHF_MERGE sections
|
// Do size optimizations: garbage collection, merging of SHF_MERGE sections
|
||||||
// and identical code folding.
|
// and identical code folding.
|
||||||
decompressSections();
|
decompressSections();
|
||||||
splitSections();
|
splitSections<ELFT>();
|
||||||
markLive<ELFT>();
|
markLive<ELFT>();
|
||||||
demoteSymbols<ELFT>();
|
demoteSymbols<ELFT>();
|
||||||
mergeSections();
|
mergeSections();
|
||||||
|
|
|
||||||
|
|
@ -836,10 +836,6 @@ static unsigned getReloc(IntTy Begin, IntTy Size, const ArrayRef<RelTy> &Rels,
|
||||||
// .eh_frame is a sequence of CIE or FDE records.
|
// .eh_frame is a sequence of CIE or FDE records.
|
||||||
// This function splits an input section into records and returns them.
|
// This function splits an input section into records and returns them.
|
||||||
template <class ELFT> void EhInputSection::split() {
|
template <class ELFT> void EhInputSection::split() {
|
||||||
// Early exit if already split.
|
|
||||||
if (!Pieces.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (AreRelocsRela)
|
if (AreRelocsRela)
|
||||||
split<ELFT>(relas<ELFT>());
|
split<ELFT>(relas<ELFT>());
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -159,10 +159,6 @@ scanEhFrameSection(EhInputSection &EH,
|
||||||
if (!EH.NumRelocations)
|
if (!EH.NumRelocations)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Unfortunately we need to split .eh_frame early since some relocations in
|
|
||||||
// .eh_frame keep other section alive and some don't.
|
|
||||||
EH.split<ELFT>();
|
|
||||||
|
|
||||||
if (EH.AreRelocsRela)
|
if (EH.AreRelocsRela)
|
||||||
scanEhFrameSection<ELFT>(EH, EH.template relas<ELFT>(), Fn);
|
scanEhFrameSection<ELFT>(EH, EH.template relas<ELFT>(), Fn);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -460,10 +460,6 @@ template <class ELFT> void EhFrameSection::addSection(InputSectionBase *C) {
|
||||||
for (auto *DS : Sec->DependentSections)
|
for (auto *DS : Sec->DependentSections)
|
||||||
DependentSections.push_back(DS);
|
DependentSections.push_back(DS);
|
||||||
|
|
||||||
// .eh_frame is a sequence of CIE or FDE records. This function
|
|
||||||
// splits it into pieces so that we can call
|
|
||||||
// SplitInputSection::getSectionPiece on the section.
|
|
||||||
Sec->split<ELFT>();
|
|
||||||
if (Sec->Pieces.empty())
|
if (Sec->Pieces.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -2540,12 +2536,14 @@ void elf::decompressSections() {
|
||||||
[](InputSectionBase *Sec) { Sec->maybeDecompress(); });
|
[](InputSectionBase *Sec) { Sec->maybeDecompress(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void elf::splitSections() {
|
template <class ELFT> void elf::splitSections() {
|
||||||
// splitIntoPieces needs to be called on each MergeInputSection
|
// splitIntoPieces needs to be called on each MergeInputSection
|
||||||
// before calling finalizeContents().
|
// before calling finalizeContents().
|
||||||
parallelForEach(InputSections, [](InputSectionBase *Sec) {
|
parallelForEach(InputSections, [](InputSectionBase *Sec) {
|
||||||
if (auto *S = dyn_cast<MergeInputSection>(Sec))
|
if (auto *S = dyn_cast<MergeInputSection>(Sec))
|
||||||
S->splitIntoPieces();
|
S->splitIntoPieces();
|
||||||
|
else if (auto *Eh = dyn_cast<EhInputSection>(Sec))
|
||||||
|
Eh->split<ELFT>();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2702,6 +2700,11 @@ template GdbIndexSection *elf::createGdbIndex<ELF32BE>();
|
||||||
template GdbIndexSection *elf::createGdbIndex<ELF64LE>();
|
template GdbIndexSection *elf::createGdbIndex<ELF64LE>();
|
||||||
template GdbIndexSection *elf::createGdbIndex<ELF64BE>();
|
template GdbIndexSection *elf::createGdbIndex<ELF64BE>();
|
||||||
|
|
||||||
|
template void elf::splitSections<ELF32LE>();
|
||||||
|
template void elf::splitSections<ELF32BE>();
|
||||||
|
template void elf::splitSections<ELF64LE>();
|
||||||
|
template void elf::splitSections<ELF64BE>();
|
||||||
|
|
||||||
template void EhFrameSection::addSection<ELF32LE>(InputSectionBase *);
|
template void EhFrameSection::addSection<ELF32LE>(InputSectionBase *);
|
||||||
template void EhFrameSection::addSection<ELF32BE>(InputSectionBase *);
|
template void EhFrameSection::addSection<ELF32BE>(InputSectionBase *);
|
||||||
template void EhFrameSection::addSection<ELF64LE>(InputSectionBase *);
|
template void EhFrameSection::addSection<ELF64LE>(InputSectionBase *);
|
||||||
|
|
|
||||||
|
|
@ -834,7 +834,7 @@ private:
|
||||||
InputSection *createInterpSection();
|
InputSection *createInterpSection();
|
||||||
MergeInputSection *createCommentSection();
|
MergeInputSection *createCommentSection();
|
||||||
void decompressSections();
|
void decompressSections();
|
||||||
void splitSections();
|
template <class ELFT> void splitSections();
|
||||||
void mergeSections();
|
void mergeSections();
|
||||||
|
|
||||||
Defined *addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
|
Defined *addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue