aboutsummaryrefslogtreecommitdiffstats
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-09 14:53:59 -0800
commitd9e427cf41893377dcdd0650ba20ff7cf7d72209 (patch)
tree6515aceab94a11861876b6e145adb6922183ebff /linker/linker_main.cpp
parent227894a754eb11cb1203c359192d59654b01b93e (diff)
downloadandroid_bionic-d9e427cf41893377dcdd0650ba20ff7cf7d72209.tar.gz
android_bionic-d9e427cf41893377dcdd0650ba20ff7cf7d72209.tar.bz2
android_bionic-d9e427cf41893377dcdd0650ba20ff7cf7d72209.zip
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: Ic33a7109a86f4262798d63a35f4c61d15b0068bb
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.