Support System.loadLibrary for libraries with transitive dependencies.
Also fix the FLAG_ERROR annoyance --- it's not helpful to cache failures.
Bug: 7896159
Bug: http://code.google.com/p/android/issues/detail?id=34416
Bug: http://code.google.com/p/android/issues/detail?id=22143
Change-Id: I60f235edb4ea4756e1f7ce56f7739f18e8a50789
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 2184f3a..a5f8944 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -55,6 +55,11 @@
return old_value;
}
+void android_update_LD_LIBRARY_PATH(const char* ld_library_path) {
+ ScopedPthreadMutexLocker locker(&gDlMutex);
+ do_android_update_LD_LIBRARY_PATH(ld_library_path);
+}
+
void* dlopen(const char* filename, int flags) {
ScopedPthreadMutexLocker locker(&gDlMutex);
soinfo* result = do_dlopen(filename, flags);
@@ -141,16 +146,16 @@
}
#if defined(ANDROID_ARM_LINKER)
-// 0000000 00011111 111112 22222222 2333333 333344444444445555555
-// 0123456 78901234 567890 12345678 9012345 678901234567890123456
+// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667
+// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890
#define ANDROID_LIBDL_STRTAB \
- "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_unwind_find_exidx\0"
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0android_update_LD_LIBRARY_PATH\0dl_unwind_find_exidx\0"
#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_MIPS_LINKER)
-// 0000000 00011111 111112 22222222 2333333 3333444444444455
-// 0123456 78901234 567890 12345678 9012345 6789012345678901
+// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667
+// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890
#define ANDROID_LIBDL_STRTAB \
- "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0android_update_LD_LIBRARY_PATH\0dl_iterate_phdr\0"
#else
#error Unsupported architecture. Only ARM, MIPS, and x86 are presently supported.
#endif
@@ -175,10 +180,11 @@
ELF32_SYM_INITIALIZER(15, &dlsym, 1),
ELF32_SYM_INITIALIZER(21, &dlerror, 1),
ELF32_SYM_INITIALIZER(29, &dladdr, 1),
+ ELF32_SYM_INITIALIZER(36, &android_update_LD_LIBRARY_PATH, 1),
#if defined(ANDROID_ARM_LINKER)
- ELF32_SYM_INITIALIZER(36, &dl_unwind_find_exidx, 1),
+ ELF32_SYM_INITIALIZER(67, &dl_unwind_find_exidx, 1),
#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_MIPS_LINKER)
- ELF32_SYM_INITIALIZER(36, &dl_iterate_phdr, 1),
+ ELF32_SYM_INITIALIZER(67, &dl_iterate_phdr, 1),
#endif
};
@@ -201,7 +207,7 @@
// Note that adding any new symbols here requires
// stubbing them out in libdl.
static unsigned gLibDlBuckets[1] = { 1 };
-static unsigned gLibDlChains[7] = { 0, 2, 3, 4, 5, 6, 0 };
+static unsigned gLibDlChains[8] = { 0, 2, 3, 4, 5, 6, 7, 0 };
// This is used by the dynamic linker. Every process gets these symbols for free.
soinfo libdl_info = {
@@ -218,7 +224,7 @@
symtab: gLibDlSymtab,
nbucket: 1,
- nchain: 7,
+ nchain: 8,
bucket: gLibDlBuckets,
chain: gLibDlChains,