summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2016-11-22 16:55:25 -0800
committerDimitry Ivanov <dimitry@google.com>2016-12-05 11:19:19 -0800
commitc12acef96bd80c419654e159e1dc24a69513a86d (patch)
tree2c9ee33aa3467a7fa0765a7a2de6c686056b755c /linker/linker_main.cpp
parentf8b4ff4aa1c1a855627b8dc36f0675d69ab9109d (diff)
Bionic loader is no longer hijacking libdl.so
Do not hijack libdl.so methods but make libdl proxy calls to loader instead. This will be replaces by calls to libc.so once loader functionality is migrated. Also add a lock to dl_unwind_find_exidx function call. Test: bionic-unit-tests --gtest_filter=dl*:Dl* Bug: http://b/27106625 Change-Id: I9e666e771e4bbca52151cfa7fc4c8677e1480818
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index a8cc81473..13edfe1f7 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -160,16 +160,11 @@ static void add_vdso(KernelArgumentBlock& args __unused) {
* relocate the offset of our exported 'rtld_db_dlactivity' symbol.
* Note that the linker shouldn't be on the soinfo list.
*/
-static void init_linker_info_for_gdb(ElfW(Addr) linker_base) {
+static void init_linker_info_for_gdb(ElfW(Addr) linker_base, char* linker_path) {
static link_map linker_link_map_for_gdb;
-#if defined(__LP64__)
- static char kLinkerPath[] = "/system/bin/linker64";
-#else
- static char kLinkerPath[] = "/system/bin/linker";
-#endif
linker_link_map_for_gdb.l_addr = linker_base;
- linker_link_map_for_gdb.l_name = kLinkerPath;
+ linker_link_map_for_gdb.l_name = linker_path;
/*
* Set the dynamic field in the link map otherwise gdb will complain with
@@ -201,6 +196,12 @@ static const char* get_executable_path() {
return executable_path.c_str();
}
+#if defined(__LP64__)
+static char kLinkerPath[] = "/system/bin/linker64";
+#else
+static char kLinkerPath[] = "/system/bin/linker";
+#endif
+
/*
* This code is called after the linker has linked itself and
* fixed it's own GOT. It is safe to make references to externs
@@ -282,7 +283,7 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
map->l_addr = 0;
map->l_name = const_cast<char*>(executable_path);
insert_link_map_into_debug_map(map);
- init_linker_info_for_gdb(linker_base);
+ init_linker_info_for_gdb(linker_base, kLinkerPath);
// Extract information passed from the kernel.
si->phdr = reinterpret_cast<ElfW(Phdr)*>(args.getauxval(AT_PHDR));
@@ -524,9 +525,8 @@ extern "C" ElfW(Addr) __linker_init(void* raw_args) {
// Initialize static variables. Note that in order to
// get correct libdl_info we need to call constructors
// before get_libdl_info().
- solist = get_libdl_info();
- sonext = get_libdl_info();
- g_default_namespace.add_soinfo(get_libdl_info());
+ sonext = solist = get_libdl_info(kLinkerPath);
+ g_default_namespace.add_soinfo(solist);
// We have successfully fixed our own relocations. It's safe to run
// the main part of the linker now.