From cb222035c23fb6a400ac110e7aef66a809f383a7 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sun, 1 Oct 2017 02:25:34 +0000 Subject: [PATCH] Run writeTo() concurrently. I don't know why we didn't use parallelForEach to call writeTo, but there should be no reason to not do that, as most writeTo functions are safe to run concurrently. llvm-svn: 314616 --- lld/ELF/Writer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 1926f1b..ee9af7c 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1910,14 +1910,16 @@ template void Writer::writeSections() { // In -r or -emit-relocs mode, write the relocation sections first as in // ELf_Rel targets we might find out that we need to modify the relocated // section while doing it. - for (OutputSection *Sec : OutputSections) + parallelForEach(OutputSections, [&](OutputSection *Sec) { if (Sec->Type == SHT_REL || Sec->Type == SHT_RELA) Sec->writeTo(Buf + Sec->Offset); + }); - for (OutputSection *Sec : OutputSections) + parallelForEach(OutputSections, [&](OutputSection *Sec) { if (Sec != Out::Opd && Sec != EhFrameHdr && Sec->Type != SHT_REL && Sec->Type != SHT_RELA) Sec->writeTo(Buf + Sec->Offset); + }); // The .eh_frame_hdr depends on .eh_frame section contents, therefore // it should be written after .eh_frame is written. -- 2.7.4