summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-03-25 05:17:31 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-03-25 05:17:32 +0000
commitdeca8effd089b7b3c97eec8a1fb5dcedb9c35ade (patch)
treee3f3c35c83a6e476d1d20c7d83274353b7bf07d3 /linker/linker_main.cpp
parentfe96db819ba0254123f4960bc150ce2c104d3bc0 (diff)
parent4cabfaad340c957ff691cfbc420b29da805c5dd8 (diff)
Merge "Load namespace configuration from ld.config.txt"
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index f976ef9a9..40f82a1bf 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -209,6 +209,8 @@ static char kLinkerPath[] = "/system/bin/linker";
* and other non-local data at this point.
*/
static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(Addr) linker_base) {
+ ProtectedDataGuard guard;
+
#if TIMING
struct timeval t0, t1;
gettimeofday(&t0, 0);
@@ -330,7 +332,7 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
somain = si;
- init_default_namespace();
+ init_default_namespace(executable_path);
if (!si->prelink_image()) {
__libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
@@ -381,19 +383,15 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
__libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
}
- {
- ProtectedDataGuard guard;
-
- si->call_pre_init_constructors();
+ si->call_pre_init_constructors();
- /* After the prelink_image, the si->load_bias is initialized.
- * For so lib, the map->l_addr will be updated in notify_gdb_of_load.
- * We need to update this value for so exe here. So Unwind_Backtrace
- * for some arch like x86 could work correctly within so exe.
- */
- map->l_addr = si->load_bias;
- si->call_constructors();
- }
+ /* After the prelink_image, the si->load_bias is initialized.
+ * For so lib, the map->l_addr will be updated in notify_gdb_of_load.
+ * We need to update this value for so exe here. So Unwind_Backtrace
+ * for some arch like x86 could work correctly within so exe.
+ */
+ map->l_addr = si->load_bias;
+ si->call_constructors();
#if TIMING
gettimeofday(&t1, nullptr);