[lld] [lld][MachO]Multi-threaded i/o. Twice as fast linking a large project. (PR #147134)

John Holdsworth via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 12 05:13:42 PDT 2025


================
@@ -1295,6 +1394,27 @@ static void createFiles(const InputArgList &args) {
       break;
     }
   }
+
+  if (config->readThreads) {
+    multiThreadedPageIn(deferredFiles);
+
+    DeferredFiles archiveContents;
+    std::vector<ArchiveFile *> archives;
+    for (auto &file : deferredFiles)
+      if (ArchiveFile *archive = dyn_cast<ArchiveFile>(
+              processFile(file.buffer, &archiveContents, file.path,
+                          LoadType::CommandLine, file.isLazy)))
+        archives.push_back(archive);
+
+    if (!archiveContents.empty()) {
+      multiThreadedPageIn(archiveContents);
+      for (auto *archive : archives)
+        archive->addLazySymbols();
+    }
----------------
johnno1962 wrote:

The pageIns can run while other code it running it just pre-empts the i/o. Deferring the archives contents made quite a difference though. I'm not sure what's happening exactly but it seems archive in the chrome link are "thin(?)" and the code references the original object files directly that  would normally be in the archive.

https://github.com/llvm/llvm-project/pull/147134


More information about the llvm-commits mailing list