mirror of
https://github.com/rui314/mold.git
synced 2024-11-10 10:57:55 +03:00
[Mach-O] Do not read the same .a more than once
This commit is contained in:
parent
a05aae7d7a
commit
1ebaf5be84
@ -552,6 +552,12 @@ static void read_file(Context<E> &ctx, MappedFile<Context<E>> *mf) {
|
||||
ctx.objs.push_back(ObjectFile<E>::create(ctx, mf, ""));
|
||||
break;
|
||||
case FileType::AR:
|
||||
if (!ctx.all_load && !ctx.loaded_archives.insert(mf->name).second) {
|
||||
// If the same .a file is specified more than once, ignore all
|
||||
// but the first one because they would be ignored anyway.
|
||||
break;
|
||||
}
|
||||
|
||||
for (MappedFile<Context<E>> *child : read_archive_members(ctx, mf))
|
||||
if (get_file_type(child) == FileType::MACH_OBJ)
|
||||
ctx.objs.push_back(ObjectFile<E>::create(ctx, child, mf->name));
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <tbb/spin_mutex.h>
|
||||
#include <tbb/task_group.h>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <variant>
|
||||
|
||||
#if MOLD_DEBUG_X86_64_ONLY
|
||||
@ -872,6 +873,7 @@ struct Context {
|
||||
bool all_load = false;
|
||||
bool needed_l = false;
|
||||
bool hidden_l = false;
|
||||
std::unordered_set<std::string_view> loaded_archives;
|
||||
|
||||
u8 uuid[16] = {};
|
||||
bool has_error = false;
|
||||
|
Loading…
Reference in New Issue
Block a user