diff options
author | Itamar <itamar8910@gmail.com> | 2020-10-10 18:17:49 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-14 23:05:53 +0100 |
commit | 07b49573612628cc6388e9fe30083dc9912b6a7b (patch) | |
tree | ba0722a6e8c74c9468a6de42a11b039fdf1ba9b5 /Libraries/LibC | |
parent | 781aa424a9b34917ad4abb1753d7cf7809dea7be (diff) | |
download | serenity-07b49573612628cc6388e9fe30083dc9912b6a7b.zip |
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.
Diffstat (limited to 'Libraries/LibC')
-rw-r--r-- | Libraries/LibC/dlfcn.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibC/dlfcn.h | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/Libraries/LibC/dlfcn.cpp b/Libraries/LibC/dlfcn.cpp index 4fac569030..04f742fcc3 100644 --- a/Libraries/LibC/dlfcn.cpp +++ b/Libraries/LibC/dlfcn.cpp @@ -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; } diff --git a/Libraries/LibC/dlfcn.h b/Libraries/LibC/dlfcn.h index 619e6df528..9363261ca6 100644 --- a/Libraries/LibC/dlfcn.h +++ b/Libraries/LibC/dlfcn.h @@ -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(); |