summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 82b10b74b..aa12b6ef1 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -116,7 +116,6 @@ soinfo* solist_get_vdso() {
}
int g_ld_debug_verbosity;
-abort_msg_t* g_abort_message = nullptr; // For debuggerd.
static std::vector<std::string> g_ld_preload_names;
@@ -299,7 +298,7 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load
#endif
// Sanitize the environment.
- __libc_init_AT_SECURE(args);
+ __libc_init_AT_SECURE(args.envp);
// Initialize system properties
__system_properties_init(); // may use 'environ'
@@ -308,7 +307,7 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load
#ifdef __ANDROID__
debuggerd_callbacks_t callbacks = {
.get_abort_message = []() {
- return g_abort_message;
+ return __libc_shared_globals()->abort_msg;
},
.post_dump = &notify_gdb_of_libraries,
};
@@ -630,12 +629,6 @@ __linker_init_post_relocation(KernelArgumentBlock& args, soinfo& tmp_linker_so)
// couldn't make system calls on x86 at that point, but we can now...
if (!tmp_linker_so.protect_relro()) __linker_cannot_link(args.argv[0]);
- // Initialize the linker/libc.so shared global inside the linker.
- static libc_shared_globals shared_globals;
- __libc_shared_globals = &shared_globals;
- __libc_init_shared_globals(&shared_globals);
- args.shared_globals = __libc_shared_globals;
-
// Initialize the linker's static libc's globals
__libc_init_globals(args);
@@ -663,13 +656,14 @@ __linker_init_post_relocation(KernelArgumentBlock& args, soinfo& tmp_linker_so)
exit(0);
}
exe_to_load = args.argv[1];
- __libc_shared_globals->initial_linker_arg_count = 1;
+ __libc_shared_globals()->initial_linker_arg_count = 1;
}
// store argc/argv/envp to use them for calling constructors
- g_argc = args.argc - __libc_shared_globals->initial_linker_arg_count;
- g_argv = args.argv + __libc_shared_globals->initial_linker_arg_count;
+ g_argc = args.argc - __libc_shared_globals()->initial_linker_arg_count;
+ g_argv = args.argv + __libc_shared_globals()->initial_linker_arg_count;
g_envp = args.envp;
+ __libc_shared_globals()->init_progname = g_argv[0];
// Initialize static variables. Note that in order to
// get correct libdl_info we need to call constructors
@@ -678,7 +672,6 @@ __linker_init_post_relocation(KernelArgumentBlock& args, soinfo& tmp_linker_so)
g_default_namespace.add_soinfo(solinker);
init_link_map_head(*solinker, kLinkerPath);
- args.abort_message_ptr = &g_abort_message;
ElfW(Addr) start_address = linker_main(args, exe_to_load);
INFO("[ Jumping to _start (%p)... ]", reinterpret_cast<void*>(start_address));