diff options
author | Rui Ueyama <ruiu@google.com> | 2017-10-01 02:25:34 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-10-01 02:25:34 +0000 |
commit | 2c314e2019f143cfa47929839ab10595cd794f81 (patch) | |
tree | 41bb0a48aebf0178b93fbe2bcf1c6579eedb55ad | |
parent | f361644fca35c8f3bca1146620bb118ee139d65a (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@314616 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | ELF/Writer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ELF/Writer.cpp b/ELF/Writer.cpp index 1926f1bd7..ee9af7c51 100644 --- a/ELF/Writer.cpp +++ b/ELF/Writer.cpp @@ -1910,14 +1910,16 @@ template <class ELFT> void Writer<ELFT>::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<ELFT>(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<ELFT>(Buf + Sec->Offset); + }); // The .eh_frame_hdr depends on .eh_frame section contents, therefore // it should be written after .eh_frame is written. |