diff options
| author | Nico Weber <thakis@chromium.org> | 2025-01-03 08:20:06 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-03 08:20:06 -0500 |
| commit | 6cd171dc3330a055a8d8a1ddff63631d42150b8a (patch) | |
| tree | ca51ea7005b177a98c5d04e5caeb0e5c2fe464fa /lld/COFF/InputFiles.cpp | |
| parent | 119fc720a19e047fee59d7f7446c911b158563e0 (diff) | |
| download | llvm-6cd171dc3330a055a8d8a1ddff63631d42150b8a.tar.gz llvm-6cd171dc3330a055a8d8a1ddff63631d42150b8a.tar.bz2 llvm-6cd171dc3330a055a8d8a1ddff63631d42150b8a.zip | |
[lld/COFF] Support thin archives in /reproduce: files (#121512)
This already worked without /wholearchive; now it works with it too.
(Only for thin archives containing relative file names, matching the ELF
and Mach-O ports.)
Diffstat (limited to 'lld/COFF/InputFiles.cpp')
| -rw-r--r-- | lld/COFF/InputFiles.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index e698f66b84f6..a94c984cfd48 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -149,11 +149,19 @@ std::vector<MemoryBufferRef> lld::coff::getArchiveMembers(COFFLinkerContext &ctx, Archive *file) { std::vector<MemoryBufferRef> v; Error err = Error::success(); + + // Thin archives refer to .o files, so --reproduces needs the .o files too. + bool addToTar = file->isThin() && ctx.driver.tar; + for (const Archive::Child &c : file->children(err)) { MemoryBufferRef mbref = CHECK(c.getMemoryBufferRef(), file->getFileName() + ": could not get the buffer for a child of the archive"); + if (addToTar) { + ctx.driver.tar->append(relativeToRoot(check(c.getFullName())), + mbref.getBuffer()); + } v.push_back(mbref); } if (err) |
