[lld] [ELF] Parallelize input file loading (PR #191690)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 23:23:27 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,
----------------
MaskRay wrote:
Adopted this style `/*inWholeArchive=*/false` , accepted by both clang-format and clang-tidy https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argument-comment.html
https://github.com/llvm/llvm-project/pull/191690
More information about the llvm-commits
mailing list