forked from OSchip/llvm-project
[ELF] Change splitSections to objectFiles based parallelForEach. NFC
The work is more balanced.
This commit is contained in:
parent
744be8c502
commit
73fd7d2304
|
@ -83,8 +83,10 @@ static ArrayRef<uint8_t> getVersion() {
|
|||
// by "readelf --string-dump .comment <file>".
|
||||
// The returned object is a mergeable string section.
|
||||
MergeInputSection *elf::createCommentSection() {
|
||||
return make<MergeInputSection>(SHF_MERGE | SHF_STRINGS, SHT_PROGBITS, 1,
|
||||
auto *sec = make<MergeInputSection>(SHF_MERGE | SHF_STRINGS, SHT_PROGBITS, 1,
|
||||
getVersion(), ".comment");
|
||||
sec->splitIntoPieces();
|
||||
return sec;
|
||||
}
|
||||
|
||||
// .MIPS.abiflags section.
|
||||
|
@ -3328,11 +3330,15 @@ template <class ELFT> void elf::splitSections() {
|
|||
llvm::TimeTraceScope timeScope("Split sections");
|
||||
// splitIntoPieces needs to be called on each MergeInputSection
|
||||
// before calling finalizeContents().
|
||||
parallelForEach(inputSections, [](InputSectionBase *sec) {
|
||||
parallelForEach(objectFiles, [](ELFFileBase *file) {
|
||||
for (InputSectionBase *sec : file->getSections()) {
|
||||
if (!sec)
|
||||
continue;
|
||||
if (auto *s = dyn_cast<MergeInputSection>(sec))
|
||||
s->splitIntoPieces();
|
||||
else if (auto *eh = dyn_cast<EhInputSection>(sec))
|
||||
eh->split<ELFT>();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue