mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:27:45 +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:
parent
36525c0572
commit
e313323317
4 changed files with 19 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue