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.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 3318c2c7f..9b4ce47c3 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -36,6 +36,7 @@
#include "linker_gdb_support.h"
#include "linker_globals.h"
#include "linker_phdr.h"
+#include "linker_tls.h"
#include "linker_utils.h"
#include "private/bionic_globals.h"
@@ -51,6 +52,7 @@
#include <async_safe/log.h>
#include <bionic/libc_init_common.h>
+#include <bionic/pthread_internal.h>
#include <vector>
@@ -450,6 +452,10 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load
si->increment_ref_count();
}
+ layout_linker_static_tls();
+
+ __libc_init_main_thread_final();
+
if (!get_cfi_shadow()->InitialLinkDone(solist)) __linker_cannot_link(g_argv[0]);
si->call_pre_init_constructors();
@@ -557,7 +563,8 @@ __linker_init_post_relocation(KernelArgumentBlock& args, soinfo& linker_so);
extern "C" ElfW(Addr) __linker_init(void* raw_args) {
// Initialize TLS early so system calls and errno work.
KernelArgumentBlock args(raw_args);
- __libc_init_main_thread_early(args);
+ bionic_tcb temp_tcb = {};
+ __libc_init_main_thread_early(args, &temp_tcb);
// When the linker is run by itself (rather than as an interpreter for
// another program), AT_BASE is 0.