Fix global variable initialization for linker

Linker now calls init functions for itself.

Change-Id: Ibd099812493041ac70f591e3f379ee742b4683b8
This commit is contained in:
Dmitriy Ivanov
2014-07-24 15:33:25 -07:00
parent 7d22a45196
commit 4151ea73b7
4 changed files with 7 additions and 21 deletions

View File

@@ -2077,12 +2077,6 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
ldpreload_env = linker_env_get("LD_PRELOAD");
}
// Linker does not call constructors for its own
// global variables so we need to initialize
// the allocators explicitly.
g_soinfo_allocator.init();
g_soinfo_links_allocator.init();
INFO("[ android linker & debugger ]");
soinfo* si = soinfo_alloc(args.argv[0], NULL);
@@ -2271,6 +2265,9 @@ extern "C" ElfW(Addr) __linker_init(void* raw_args) {
_exit(EXIT_FAILURE);
}
// lets properly initialize global variables
linker_so.CallConstructors();
// We have successfully fixed our own relocations. It's safe to run
// the main part of the linker now.
args.abort_message_ptr = &g_abort_message;