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

Loader: Add dynamic loader program

The dynamic loader exists as /usr/lib/Loader.so and is loaded by the
kernel when ET_DYN programs are executed.

The dynamic loader is responsible for loading the dependencies of the
main program, allocating TLS storage, preparing all loaded objects for
execution and finally jumping to the entry of the main program.
This commit is contained in:
Itamar 2020-10-10 18:17:49 +03:00 committed by Andreas Kling
parent 781aa424a9
commit 07b4957361
18 changed files with 962 additions and 104 deletions

View file

@ -101,7 +101,9 @@ void* dlopen(const char* filename, int flags)
return nullptr;
}
if (!loader->load_from_image(flags)) {
if (!loader->load_from_image(flags,
0 // total_tls_size = 0, FIXME: Support TLS when using dlopen()
)) {
g_dlerror_msg = String::format("Failed to load ELF object %s", filename);
return nullptr;
}

View file

@ -31,10 +31,10 @@
__BEGIN_DECLS
#define RTLD_DEFAULT 0
#define RTLD_LAZY 1
#define RTLD_NOW 2
#define RTLD_GLOBAL 3
#define RTLD_LOCAL 4
#define RTLD_LAZY 2
#define RTLD_NOW 4
#define RTLD_GLOBAL 8
#define RTLD_LOCAL 16
int dlclose(void*);
char* dlerror();