summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d4a7b0)
raw | patch | inline | side by side (parent: 3d4a7b0)
author | Dmitriy Ivanov <dimitry@google.com> | |
Thu, 22 May 2014 05:42:24 +0000 (22:42 -0700) | ||
committer | Dmitriy Ivanov <dimitry@google.com> | |
Thu, 22 May 2014 05:42:24 +0000 (22:42 -0700) |
* Removed unnecessary NULL check in dlsym
* Fixed dlsym_failure test to account for
correct RTLD_DEFAULT value
* Added temporary check for legacy RTLD_DEFAULT
value for non-yet-recompiled binaries
Bug: 15146875
Change-Id: I089fa673762629f5724b6e4fbca019d9cfc39905
* Fixed dlsym_failure test to account for
correct RTLD_DEFAULT value
* Added temporary check for legacy RTLD_DEFAULT
value for non-yet-recompiled binaries
Bug: 15146875
Change-Id: I089fa673762629f5724b6e4fbca019d9cfc39905
linker/dlfcn.cpp | patch | blob | history | |
tests/dlfcn_test.cpp | patch | blob | history |
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 7e3b3f41d9a600928ca583265fc52b2e951ae6f2..7bcb59f166e6480a21c00185403529d1eaf437ff 100644 (file)
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
void* dlsym(void* handle, const char* symbol) {
ScopedPthreadMutexLocker locker(&g_dl_mutex);
+#if !defined(__LP64__)
if (handle == NULL) {
__bionic_format_dlerror("dlsym library handle is null", NULL);
return NULL;
}
+#endif
+
if (symbol == NULL) {
__bionic_format_dlerror("dlsym symbol name is null", NULL);
return NULL;
soinfo* found = NULL;
ElfW(Sym)* sym = NULL;
- if (handle == RTLD_DEFAULT) {
+ if (handle == RTLD_DEFAULT || handle == (void*)0xffffffffL) {
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);
soinfo* si = find_containing_library(caller_addr);
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 434e38f91133c933e2867baf1426aca188c128fa..3459a562e9811b46ba62bcdcfe004e1a5f89048e 100644 (file)
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
void* sym;
+ // lp64 RTLD_DEFAULT=(void*)0
+#if !defined(__LP64__)
// NULL handle.
sym = dlsym(NULL, "test");
ASSERT_TRUE(sym == NULL);
#else
ASSERT_SUBSTR("undefined symbol: test", dlerror()); // glibc isn't specific about the failure.
#endif
+#endif // !defined(__LP64__)
// NULL symbol name.
#if defined(__BIONIC__)