diff options
author | Elliott Hughes <enh@google.com> | 2019-05-09 15:56:39 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2019-05-09 22:12:17 -0700 |
commit | 90f96b9f483b8effefd6a6fe8a8f0562f616837e (patch) | |
tree | 79681d6b86ab2c8c211bf5e39f91a1bf73d6bc95 /linker/linker.cpp | |
parent | 81063190064ce84aee135a52b16f53cce50b950a (diff) |
linker: support ldd(1)-like behavior via --list.
Given that we have both linker and linker64, I didn't really want to have
to have ldd and ldd64, so this change just adds the --list option to the
linkers and a shell script wrapper "ldd" that calls the appropriate
linker behind the scenes.
Test: adb shell linker --list `which app_process32`
Test: adb shell linker64 --list `which date`
Test: adb shell ldd `which app_process32`
Test: adb shell ldd `which date`
Change-Id: I33494bda1cc3cafee54e091f97c0f2ae52d1f74b
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 0de17f780..f68775c19 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -2596,6 +2596,8 @@ bool link_namespaces_all_libs(android_namespace_t* namespace_from, } ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr) { + if (g_is_ldd) return 0; + typedef ElfW(Addr) (*ifunc_resolver_t)(void); ifunc_resolver_t ifunc_resolver = reinterpret_cast<ifunc_resolver_t>(resolver_addr); ElfW(Addr) ifunc_addr = ifunc_resolver(); @@ -3876,6 +3878,11 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t& return true; } + if (g_is_ldd && !is_main_executable()) { + async_safe_format_fd(STDOUT_FILENO, "\t%s => %s (%p)\n", get_soname(), + get_realpath(), reinterpret_cast<void*>(base)); + } + local_group_root_ = local_group.front(); if (local_group_root_ == nullptr) { local_group_root_ = this; |