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
This commit is contained in:
@@ -55,6 +55,11 @@ const char* dlerror() {
|
||||
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 @@ int dlclose(void* handle) {
|
||||
}
|
||||
|
||||
#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 @@ static Elf32_Sym gLibDlSymtab[] = {
|
||||
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 @@ static Elf32_Sym gLibDlSymtab[] = {
|
||||
// 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 @@ soinfo libdl_info = {
|
||||
symtab: gLibDlSymtab,
|
||||
|
||||
nbucket: 1,
|
||||
nchain: 7,
|
||||
nchain: 8,
|
||||
bucket: gLibDlBuckets,
|
||||
chain: gLibDlChains,
|
||||
|
||||
|
Reference in New Issue
Block a user