[lld-macho] Support parsing of bitcode within archives
authorJez Ng <jezng@fb.com>
Wed, 2 Dec 2020 22:12:51 +0000 (14:12 -0800)
committerJez Ng <jezng@fb.com>
Tue, 8 Dec 2020 18:34:32 +0000 (10:34 -0800)
commit78976bf3dae2a4fac3b7fb2ab1a8d8e986ea36ff
treee542fe2ec2c4f294f1d6ef1b378a80fbf206e56e
parent7b007ac0800babe750c58b1aead15e1c3e7f3b0f
[lld-macho] Support parsing of bitcode within archives

Also error out if we find anything other than an object or bitcode file
in the archive.

Note that we were previously inserting the symbols and sections of the
unpacked ObjFile into the containing ArchiveFile. This was actually
unnecessary -- we can just insert the ObjectFile (or BitcodeFile) into
the `inputFiles` vector. This is the approach taken by LLD-ELF.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D92539
lld/MachO/InputFiles.cpp
lld/test/MachO/bitcode-nodatalayout.ll [new file with mode: 0644]
lld/test/MachO/invalid/bad-archive-member.s [new file with mode: 0644]
lld/test/MachO/lto-archive.ll [new file with mode: 0644]