[PATCH] D126800: Write output sections in parallel

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 16:17:03 PDT 2022


thakis added a comment.

(This is on an M1 <https://reviews.llvm.org/M1> mac in case it matters. The test fails both with the patch as-is as well as with append_range. My local diff for the latter, in case you want to apply it on your end, is:

  % git diff
  diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
  index 14d870144390..a485ba97d8d3 100644
  --- a/lld/MachO/Writer.cpp
  +++ b/lld/MachO/Writer.cpp
  @@ -1083,10 +1083,8 @@ void Writer::openFile() {
   void Writer::writeSections() {
     uint8_t *buf = buffer->getBufferStart();
     std::vector<const OutputSection *> osecs;
  -  for (const OutputSegment *seg : outputSegments) {
  -    const std::vector<OutputSection *> &sections = seg->getSections();
  -    osecs.insert(osecs.end(), sections.begin(), sections.end());
  -  }
  +  for (const OutputSegment *seg : outputSegments)
  +    append_range(osecs, seg->getSections());
   
     parallelForEach(osecs.begin(), osecs.end(), [&](const OutputSection *osec) {
       osec->writeTo(buf + osec->fileOff);

)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126800/new/

https://reviews.llvm.org/D126800



More information about the llvm-commits mailing list