Merge "Removed dlsym handle != NULL check for lp64"
This commit is contained in:
commit
3eb9f1f6ba
@ -89,10 +89,13 @@ void* dlopen(const char* filename, int flags) {
|
|||||||
void* dlsym(void* handle, const char* symbol) {
|
void* dlsym(void* handle, const char* symbol) {
|
||||||
ScopedPthreadMutexLocker locker(&g_dl_mutex);
|
ScopedPthreadMutexLocker locker(&g_dl_mutex);
|
||||||
|
|
||||||
|
#if !defined(__LP64__)
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
__bionic_format_dlerror("dlsym library handle is null", NULL);
|
__bionic_format_dlerror("dlsym library handle is null", NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (symbol == NULL) {
|
if (symbol == NULL) {
|
||||||
__bionic_format_dlerror("dlsym symbol name is null", NULL);
|
__bionic_format_dlerror("dlsym symbol name is null", NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -100,9 +103,9 @@ void* dlsym(void* handle, const char* symbol) {
|
|||||||
|
|
||||||
soinfo* found = NULL;
|
soinfo* found = NULL;
|
||||||
ElfW(Sym)* sym = NULL;
|
ElfW(Sym)* sym = NULL;
|
||||||
if (handle == RTLD_DEFAULT) {
|
if (handle == RTLD_DEFAULT || handle == (void*)0xffffffffL) {
|
||||||
sym = dlsym_linear_lookup(symbol, &found, NULL);
|
sym = dlsym_linear_lookup(symbol, &found, NULL);
|
||||||
} else if (handle == RTLD_NEXT || handle == (void*)0xffffffffL) {
|
} else if (handle == RTLD_NEXT || handle == (void*)0xfffffffeL) {
|
||||||
void* caller_addr = __builtin_return_address(0);
|
void* caller_addr = __builtin_return_address(0);
|
||||||
soinfo* si = find_containing_library(caller_addr);
|
soinfo* si = find_containing_library(caller_addr);
|
||||||
|
|
||||||
|
@ -101,6 +101,8 @@ TEST(dlfcn, dlsym_failures) {
|
|||||||
|
|
||||||
void* sym;
|
void* sym;
|
||||||
|
|
||||||
|
// lp64 RTLD_DEFAULT=(void*)0
|
||||||
|
#if !defined(__LP64__)
|
||||||
// NULL handle.
|
// NULL handle.
|
||||||
sym = dlsym(NULL, "test");
|
sym = dlsym(NULL, "test");
|
||||||
ASSERT_TRUE(sym == NULL);
|
ASSERT_TRUE(sym == NULL);
|
||||||
@ -109,6 +111,7 @@ TEST(dlfcn, dlsym_failures) {
|
|||||||
#else
|
#else
|
||||||
ASSERT_SUBSTR("undefined symbol: test", dlerror()); // glibc isn't specific about the failure.
|
ASSERT_SUBSTR("undefined symbol: test", dlerror()); // glibc isn't specific about the failure.
|
||||||
#endif
|
#endif
|
||||||
|
#endif // !defined(__LP64__)
|
||||||
|
|
||||||
// NULL symbol name.
|
// NULL symbol name.
|
||||||
#if defined(__BIONIC__)
|
#if defined(__BIONIC__)
|
||||||
|
Loading…
Reference in New Issue
Block a user