diff options
author | Dimitry Ivanov <dimitry@google.com> | 2017-03-07 11:19:05 -0800 |
---|---|---|
committer | Dimitry Ivanov <dimitry@google.com> | 2017-03-24 15:50:45 -0700 |
commit | 4cabfaad340c957ff691cfbc420b29da805c5dd8 (patch) | |
tree | 91df98d18f36ed19f857db91688c8b62f6f242de /linker/linker_main.cpp | |
parent | e98d1e68ce37bb9238e3c50ea6b01d1057adb2eb (diff) |
Load namespace configuration from ld.config.txt
This change allows customization of default namespace
configuration for different executables. It also enables
target_sdk_version setup for binaries (note that this
option should explicitly be enabled in ld.config.txt).
Bug: http://b/30706810
Bug: http://b/30435785
Test: run linker-unit-tests/bionic-unit-tests, boot angler
Change-Id: Ibbe87209acf1538fc9cec04944f3d22a190c38f1
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r-- | linker/linker_main.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp index d037a1832..6870c03aa 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); |