summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver/DarwinInputGraph.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/Driver/DarwinInputGraph.cpp')
-rw-r--r--lld/lib/Driver/DarwinInputGraph.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/lld/lib/Driver/DarwinInputGraph.cpp b/lld/lib/Driver/DarwinInputGraph.cpp
index 1ddde24b534..f71afb066fa 100644
--- a/lld/lib/Driver/DarwinInputGraph.cpp
+++ b/lld/lib/Driver/DarwinInputGraph.cpp
@@ -35,31 +35,21 @@ std::error_code MachOFileNode::parse(const LinkingContext &ctx,
narrowFatBuffer(*filePath);
std::vector<std::unique_ptr<File>> parsedFiles;
- if (_isWholeArchive) {
- std::error_code ec = ctx.registry().parseFile(_buffer, parsedFiles);
- if (ec)
- return ec;
- assert(parsedFiles.size() == 1);
- std::unique_ptr<File> f(parsedFiles[0].release());
- if (auto archive =
- reinterpret_cast<const ArchiveLibraryFile *>(f.get())) {
- // FIXME: something needs to own archive File
- //_files.push_back(std::move(archive));
- return archive->parseAllMembers(_files);
- } else {
- // if --whole-archive is around non-archive, just use it as normal.
- _files.push_back(std::move(f));
- return std::error_code();
- }
- }
if (std::error_code ec = ctx.registry().parseFile(_buffer, parsedFiles))
return ec;
for (std::unique_ptr<File> &pf : parsedFiles) {
- // If a dylib was parsed, inform LinkingContext about it.
+ // If file is a dylib, inform LinkingContext about it.
if (SharedLibraryFile *shl = dyn_cast<SharedLibraryFile>(pf.get())) {
_context.registerDylib(reinterpret_cast<mach_o::MachODylibFile*>(shl),
_upwardDylib);
}
+ // If file is an archive and -all_load, then add all members.
+ if (ArchiveLibraryFile *archive = dyn_cast<ArchiveLibraryFile>(pf.get())) {
+ if (_isWholeArchive) {
+ // Note: the members are added to _files, but the archive is not.
+ return archive->parseAllMembers(_files);
+ }
+ }
_files.push_back(std::move(pf));
}
return std::error_code();
OpenPOWER on IntegriCloud