1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:07:34 +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

@ -49,7 +49,10 @@ public:
// Load a full ELF image from file into the current process and create an DynamicObject
// from the SHT_DYNAMIC in the file.
RefPtr<DynamicObject> load_from_image(unsigned flags, size_t total_tls_size);
// Note that the DynamicObject will not be linked yet. Callers are responsible for calling link() to finish it.
RefPtr<DynamicObject> map();
bool link(unsigned flags, size_t total_tls_size);
// Stage 2 of loading: dynamic object loading and primary relocations
bool load_stage_2(unsigned flags, size_t total_tls_size);