1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:57:35 +00:00

LibELF: Split the DynamicLoader's loading mechanism into two steps

load_from_image() becomes map() and link(). This allows us to map
an object before mapping its dependencies.

This solves an issue where fixed-position executables (like GCC)
would clash with the ASLR placement of their own shared libraries.
This commit is contained in:
Andreas Kling 2021-01-31 11:46:00 +01:00
parent 36525c0572
commit e313323317
4 changed files with 19 additions and 13 deletions

View file

@ -88,9 +88,8 @@ void* dlopen(const char* filename, int flags)
return nullptr;
}
if (!loader->load_from_image(flags,
0 // total_tls_size = 0, FIXME: Support TLS when using dlopen()
)) {
auto object = loader->map();
if (!object || !loader->link(flags, /* total_tls_size (FIXME) */ 0)) {
g_dlerror_msg = String::formatted("Failed to load ELF object {}", filename);
return nullptr;
}