[lld] [ELF] Parallelize input file loading (PR #191690)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 10:56:49 PDT 2026


================
@@ -253,93 +238,59 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
   MemoryBufferRef mbref = *buffer;
 
   if (ctx.arg.formatBinary) {
-    files.push_back(std::make_unique<BinaryFile>(ctx, mbref));
-    if (!isInGroup)
-      ++nextGroupId;
-    return;
-  }
-
-  switch (identify_magic(mbref.getBuffer())) {
-  case file_magic::unknown:
-    readLinkerScript(ctx, mbref);
-    return;
-  case file_magic::archive: {
-    auto members = getArchiveMembers(ctx, mbref);
-    if (inWholeArchive) {
-      for (const std::pair<MemoryBufferRef, uint64_t> &p : members) {
-        if (isBitcode(p.first))
-          files.push_back(std::make_unique<BitcodeFile>(ctx, p.first, path,
-                                                        p.second, false));
-        else if (!tryAddFatLTOFile(p.first, path, p.second, false))
-          files.push_back(createObjFile(ctx, p.first, path));
-      }
+    loadJobs.push_back({mbref,
+                        path,
+                        LoadJob::Binary,
+                        false,
----------------
smithp35 wrote:

Could be worth adding field comments here. Something like:
```
/* inWholeArchive */ false,
/* lazy */ false,
/* asNeeded */ false,
/* withLoption */ false,
```
Alternatively could make these enums in the LoadJob

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


More information about the llvm-commits mailing list