mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-26 17:01:07 +00:00
ldso: cleanup if loading of 'Shared_object' fails
This can happen, for example, during 'dlopen' if unresolved symbols are present. * Unload already loaded shared libraries * Delete dependencies * Flush initializer list (ctors) fixes #3073
This commit is contained in:
parent
7c4986bd83
commit
3347d08b79
@ -91,5 +91,13 @@ Linker::Root_object::Root_object(Env &env, Allocator &md_alloc,
|
||||
new (md_alloc) Dependency(env, md_alloc, linker_name(), this, _deps, DONT_KEEP);
|
||||
|
||||
/* relocate and call constructors */
|
||||
Init::list()->initialize(bind, STAGE_SO);
|
||||
try {
|
||||
Init::list()->initialize(bind, STAGE_SO);
|
||||
} catch (...) {
|
||||
Init::list()->flush();
|
||||
while (Dependency *d = _deps.dequeue())
|
||||
destroy(_md_alloc, d);
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +132,15 @@ struct Linker::Init : List<Object>
|
||||
|
||||
in_progress = false;
|
||||
}
|
||||
|
||||
void flush()
|
||||
{
|
||||
while (Object *obj = first())
|
||||
remove(obj);
|
||||
|
||||
in_progress = false;
|
||||
restart = false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__INIT_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user