[ELF] - Use multithreading for building .gdb_index.

Enables multithreaded .gdb_index building.

Differential revision: https://reviews.llvm.org/D36090

llvm-svn: 309688
This commit is contained in:
George Rimar 2017-08-01 14:57:13 +00:00
parent 004bd1237d
commit 2d23da0033
1 changed files with 6 additions and 5 deletions

View File

@ -1813,12 +1813,13 @@ static GdbIndexChunk readDwarf(DWARFContext &Dwarf, InputSection *Sec) {
}
template <class ELFT> GdbIndexSection *elf::createGdbIndex() {
std::vector<GdbIndexChunk> Chunks;
for (InputSection *Sec : getDebugInfoSections()) {
ObjFile<ELFT> *F = Sec->getFile<ELFT>();
std::vector<InputSection *> Sections = getDebugInfoSections();
std::vector<GdbIndexChunk> Chunks(Sections.size());
parallelForEachN(0, Chunks.size(), [&](size_t I) {
ObjFile<ELFT> *F = Sections[I]->getFile<ELFT>();
DWARFContext Dwarf(make_unique<LLDDwarfObj<ELFT>>(F));
Chunks.push_back(readDwarf(Dwarf, Sec));
}
Chunks[I] = readDwarf(Dwarf, Sections[I]);
});
return make<GdbIndexSection>(std::move(Chunks));
}