[lld] [lld-macho] Fix unchecked Error crash for thin archive missing child (PR #97169)
Daniel Bertalan via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 14:32:27 PDT 2024
================
@@ -349,7 +349,14 @@ static InputFile *addFile(StringRef path, LoadType loadType,
Error e = Error::success();
for (const object::Archive::Child &c : file->getArchive().children(e)) {
Expected<MemoryBufferRef> mb = c.getMemoryBufferRef();
- if (!mb || !hasObjCSection(*mb))
+ if (!mb) {
+ // Thin archives from repro tarballs can contain missing members
+ // if the member was not loaded later during the initial link.
----------------
BertalanD wrote:
I ended up basically going for the approach outlined here:
- also include unused object files in the repro tarball
- warn on missing member
- make warning toggleable so we don't get spam on stderr when processing old repro files
My last question is what should happen if we don't find members when force-loading, i.e.:
https://github.com/llvm/llvm-project/blob/2ad7b4af95bc333d8f216915cd1b9d688590dcc5/lld/MachO/Driver.cpp#L333-L335
Downgrade this to a warning too? This was not affected by the issue we're fixing (since `fetch()` was called unconditionally here), but if we add a user-facing option, we should be consistent about our behavior.
https://github.com/llvm/llvm-project/pull/97169
More information about the llvm-commits
mailing list