summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-05-31 22:32:32 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-05-31 22:32:32 +0000
commitfe55c272adf89ecf14c5aa068119bfadf2c28457 (patch)
treed1a85abde4d938afe68cd1ce4c89c1cd4665d170 /linker/linker_main.cpp
parent30144561a4953522cf495a68e4324e6ad01f24de (diff)
parent27475b5105e30332dd2145e0bfba098b756673d9 (diff)
Merge "Initialize __libc_sysinfo early on."
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index fa4fd4ccb..331f83171 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -510,6 +510,10 @@ static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf) {
extern "C" ElfW(Addr) __linker_init(void* raw_args) {
KernelArgumentBlock args(raw_args);
+#if defined(__i386__)
+ __libc_init_sysinfo(args);
+#endif
+
// AT_BASE is set to 0 in the case when linker is run by iself
// so in order to link the linker it needs to calcuate AT_BASE
// using information at hand. The trick below takes advantage
@@ -552,15 +556,6 @@ extern "C" ElfW(Addr) __linker_init(void* raw_args) {
// functions at this point.
if (!linker_so.link_image(g_empty_list, g_empty_list, nullptr)) __linker_cannot_link(args.argv[0]);
-#if defined(__i386__)
- // On x86, we can't make system calls before this point.
- // We can't move this up because this needs to assign to a global.
- // Note that until we call __libc_init_main_thread below we have
- // no TLS, so you shouldn't make a system call that can fail, because
- // it will SEGV when it tries to set errno.
- __libc_init_sysinfo(args);
-#endif
-
// Initialize the main thread (including TLS, so system calls really work).
__libc_init_main_thread(args);