1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

LibELF: Check if initializers ran instead of trusting s_global_objects

The original heuristic of "a library being in `s_global_objects` means
that it was fully initialized already" doesn't hold up anymore since we
changed the loading order. This was causing us to skip parts of the
initialization of dependency libraries when running dlopen (since it was
the only user of that setting).

Instead, set a flag after we run stage 4 (which is the "run the global
initializers" stage) and check that flag when determining unfinished
dependencies. This entirely replaces the `skip_global_objects` logic.
This commit is contained in:
Tim Schumacher 2022-06-24 10:50:34 +02:00 committed by Linus Groh
parent ef1c97e3d8
commit 082a7baa3b
3 changed files with 18 additions and 10 deletions

View file

@ -249,6 +249,8 @@ Result<NonnullRefPtr<DynamicObject>, DlErrorMessage> DynamicLoader::load_stage_3
void DynamicLoader::load_stage_4()
{
call_object_init_functions();
m_fully_initialized = true;
}
void DynamicLoader::do_lazy_relocations()