1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

LibELF: Make SymbolLookupResult::address a VirtualAddress

Let's use a stronger type than void* for this since we're talking
specifically about a virtual address and not necessarily a pointer
to something actually in memory (yet).
This commit is contained in:
Andreas Kling 2021-02-20 23:59:17 +01:00
parent c5d93e55d0
commit a43910acc3
4 changed files with 28 additions and 32 deletions

View file

@ -158,20 +158,20 @@ static void initialize_libc(DynamicObject& libc)
// because it uses getenv() internally, so `environ` has to be initialized before we call `__libc_init`.
auto res = libc.lookup_symbol("environ");
ASSERT(res.has_value());
*((char***)res.value().address) = g_envp;
*((char***)res.value().address.as_ptr()) = g_envp;
res = libc.lookup_symbol("__environ_is_malloced");
ASSERT(res.has_value());
*((bool*)res.value().address) = false;
*((bool*)res.value().address.as_ptr()) = false;
res = libc.lookup_symbol("exit");
ASSERT(res.has_value());
g_libc_exit = (LibCExitFunction)res.value().address;
g_libc_exit = (LibCExitFunction)res.value().address.as_ptr();
res = libc.lookup_symbol("__libc_init");
ASSERT(res.has_value());
typedef void libc_init_func();
((libc_init_func*)res.value().address)();
((libc_init_func*)res.value().address.as_ptr())();
}
template<typename Callback>