diff options
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r-- | linker/linker_main.cpp | 13 |
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); |