mirror of
https://github.com/rui314/mold.git
synced 2024-09-21 18:08:01 +03:00
wip
This commit is contained in:
parent
bc156aa03e
commit
bbca727170
3
mold.h
3
mold.h
@ -1289,6 +1289,9 @@ struct Context {
|
||||
ConcurrentMap<ComdatGroup> comdat_groups;
|
||||
FileCache<E, ObjectFile<E>> obj_cache;
|
||||
FileCache<E, SharedFile<E>> dso_cache;
|
||||
std::mutex mu;
|
||||
std::vector<std::unique_ptr<ObjectFile<E>>> owning_objs;
|
||||
std::vector<std::unique_ptr<ObjectFile<E>>> owning_dsos;
|
||||
|
||||
// Symbol auxiliary data
|
||||
std::vector<SymbolAux> symbol_aux;
|
||||
|
@ -124,7 +124,10 @@ template <typename E>
|
||||
ObjectFile<E> *
|
||||
ObjectFile<E>::create(Context<E> &ctx, MemoryMappedFile<E> *mb,
|
||||
std::string archive_name, bool is_in_lib) {
|
||||
return new ObjectFile<E>(ctx, mb, archive_name, is_in_lib);
|
||||
ObjectFile<E> *obj = new ObjectFile<E>(ctx, mb, archive_name, is_in_lib);
|
||||
std::lock_guard lock(ctx.mu);
|
||||
ctx.owning_objs.push_back(std::unique_ptr<ObjectFile<E>>(obj));
|
||||
return obj;
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
@ -1082,6 +1085,9 @@ ObjectFile<E>::create_internal_file(Context<E> &ctx) {
|
||||
|
||||
i64 num_globals = obj->elf_syms.size() - obj->first_global;
|
||||
obj->symvers.resize(num_globals);
|
||||
|
||||
std::lock_guard lock(ctx.mu);
|
||||
ctx.owning_objs.push_back(std::unique_ptr<ObjectFile<E>>(obj));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user