[lld] 73fd7d2 - [ELF] Change splitSections to objectFiles based parallelForEach. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 30 13:34:32 PST 2022
Author: Fangrui Song
Date: 2022-01-30T13:34:27-08:00
New Revision: 73fd7d23046c1415b6be1bbe11c806edf3244837
URL: https://github.com/llvm/llvm-project/commit/73fd7d23046c1415b6be1bbe11c806edf3244837
DIFF: https://github.com/llvm/llvm-project/commit/73fd7d23046c1415b6be1bbe11c806edf3244837.diff
LOG: [ELF] Change splitSections to objectFiles based parallelForEach. NFC
The work is more balanced.
Added:
Modified:
lld/ELF/SyntheticSections.cpp
Removed:
################################################################################
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 1bcf9d17c8cb5..8c0c3abb9d19e 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -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,
- getVersion(), ".comment");
+ 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) {
- if (auto *s = dyn_cast<MergeInputSection>(sec))
- s->splitIntoPieces();
- else if (auto *eh = dyn_cast<EhInputSection>(sec))
- eh->split<ELFT>();
+ 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>();
+ }
});
}
More information about the llvm-commits
mailing list