[PATCH] D88288: [Archive] Don't throw away errors for malformed archive members

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 02:29:49 PDT 2020


jhenderson created this revision.
jhenderson added reviewers: grimar, MaskRay, ruiu.
Herald added subscribers: hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
jhenderson requested review of this revision.

When adding an archive member with a problem, e.g. a new bitcode with an old archiver, containing an unsupported attribute, or an ELF file with a malformed symbol table, the archiver would throw away the error and simply add the member to the archive without any symbol entries. This meant that the resultant archive could be silently unusable when not using --whole-archive, and result in unexpected undefined symbols.

This change fixes this issue by addressing two FIXMEs and only throwing away not-an-object errors. However, this meant that some LLD tests which didn't need symbol tables and were using invalid members deliberately to test the linker's malformed input handling no longer worked, so this patch also stops the archiver from looking for symbols in an object if it doesn't require a symbol table, and updates the tests accordingly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88288

Files:
  lld/test/ELF/invalid/data-encoding.test
  lld/test/ELF/invalid/invalid-file-class.test
  llvm/lib/Object/ArchiveWriter.cpp
  llvm/test/Object/archive-malformed-object.test
  llvm/test/Object/archive-unknown-filetype.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88288.294258.patch
Type: text/x-patch
Size: 6402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200925/ac2cc1d0/attachment.bin>


More information about the llvm-commits mailing list