[PATCH] D126800: Write output sections in parallel
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 8 17:12:11 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG44978a234b8e: [lld/mac] Write output sections in parallel (authored by michaeleisel, committed by thakis).
Changed prior to commit:
https://reviews.llvm.org/D126800?vs=433541&id=435392#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126800/new/
https://reviews.llvm.org/D126800
Files:
lld/MachO/Writer.cpp
lld/test/MachO/invalid/range-check.s
Index: lld/test/MachO/invalid/range-check.s
===================================================================
--- lld/test/MachO/invalid/range-check.s
+++ lld/test/MachO/invalid/range-check.s
@@ -6,11 +6,11 @@
# RUN: %lld -dylib %t/bar.o -o %t/libbar.dylib
# RUN: not %lld -lSystem -o /dev/null %t/libbar.dylib %t/test.o 2>&1 | FileCheck %s
-# CHECK: error: {{.*}}test.o:(symbol _main+0xd): relocation UNSIGNED is out of range: [[#]] is not in [0, 4294967295]; references _foo
-# CHECK: error: {{.*}}test.o:(symbol _main+0x3): relocation GOT_LOAD is out of range: [[#]] is not in [-2147483648, 2147483647]; references _foo
-# CHECK: error: stub is out of range: [[#]] is not in [-2147483648, 2147483647]; references _bar
-# CHECK: error: stub helper header is out of range: [[#]] is not in [-2147483648, 2147483647]
-# CHECK: error: stub helper header is out of range: [[#]] is not in [-2147483648, 2147483647]
+# CHECK-DAG: error: {{.*}}test.o:(symbol _main+0xd): relocation UNSIGNED is out of range: [[#]] is not in [0, 4294967295]; references _foo
+# CHECK-DAG: error: {{.*}}test.o:(symbol _main+0x3): relocation GOT_LOAD is out of range: [[#]] is not in [-2147483648, 2147483647]; references _foo
+# CHECK-DAG: error: stub is out of range: [[#]] is not in [-2147483648, 2147483647]; references _bar
+# CHECK-DAG: error: stub helper header is out of range: [[#]] is not in [-2147483648, 2147483647]
+# CHECK-DAG: error: stub helper header is out of range: [[#]] is not in [-2147483648, 2147483647]
#--- bar.s
.globl _bar
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -20,6 +20,7 @@
#include "SyntheticSections.h"
#include "Target.h"
#include "UnwindInfoSection.h"
+#include "llvm/Support/Parallel.h"
#include "lld/Common/Arrays.h"
#include "lld/Common/CommonLinkerContext.h"
@@ -1081,9 +1082,13 @@
void Writer::writeSections() {
uint8_t *buf = buffer->getBufferStart();
+ std::vector<const OutputSection *> osecs;
for (const OutputSegment *seg : outputSegments)
- for (const OutputSection *osec : seg->getSections())
- osec->writeTo(buf + osec->fileOff);
+ append_range(osecs, seg->getSections());
+
+ parallelForEach(osecs.begin(), osecs.end(), [&](const OutputSection *osec) {
+ osec->writeTo(buf + osec->fileOff);
+ });
}
// In order to utilize multiple cores, we first split the buffer into chunks,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126800.435392.patch
Type: text/x-patch
Size: 2456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220609/dff84d47/attachment.bin>
More information about the llvm-commits
mailing list