Fix global variable initialization for linker
Linker now calls init functions for itself.
Change-Id: Ibd099812493041ac70f591e3f379ee742b4683b8
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 04ffe59..4c76594 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2077,12 +2077,6 @@
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 @@
_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;