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
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 62e6bb6..cb658ba 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -324,9 +324,7 @@
// in that section (via *pcount).
//
// Intended to be called by libc's __gnu_Unwind_Find_exidx().
-//
-// This function is exposed via dlfcn.cpp and libdl.so.
-_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) {
+_Unwind_Ptr do_dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) {
uintptr_t addr = reinterpret_cast<uintptr_t>(pc);
for (soinfo* si = solist_get_head(); si != 0; si = si->next) {
@@ -1730,8 +1728,9 @@
info->library_namespace : nullptr);
}
-void* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo,
- void* caller_addr) {
+void* do_dlopen(const char* name, int flags,
+ const android_dlextinfo* extinfo,
+ const void* caller_addr) {
soinfo* const caller = find_containing_library(caller_addr);
android_namespace_t* ns = get_caller_namespace(caller);
@@ -1855,8 +1854,11 @@
return static_cast<soinfo*>(handle);
}
-bool do_dlsym(void* handle, const char* sym_name, const char* sym_ver,
- void* caller_addr, void** symbol) {
+bool do_dlsym(void* handle,
+ const char* sym_name,
+ const char* sym_ver,
+ const void* caller_addr,
+ void** symbol) {
#if !defined(__LP64__)
if (handle == nullptr) {
DL_ERR("dlsym failed: library handle is null");