Fix __errno for LP64 and clean up __get_tls.
If __get_tls has the right type, a lot of confusing casting can disappear.
It was probably a mistake that __get_tls was exposed as a function for mips
and x86 (but not arm), so let's (a) ensure that the __get_tls function
always matches the macro, (b) that we have the function for arm too, and
(c) that we don't have the function for any 64-bit architecture.
Change-Id: Ie9cb989b66e2006524ad7733eb6e1a65055463be
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index a61cfa8..3553af7 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -31,8 +31,7 @@
static pthread_mutex_t gDlMutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
static const char* __bionic_set_dlerror(char* new_value) {
- void* tls = const_cast<void*>(__get_tls());
- char** dlerror_slot = &reinterpret_cast<char**>(tls)[TLS_SLOT_DLERROR];
+ char** dlerror_slot = &reinterpret_cast<char**>(__get_tls())[TLS_SLOT_DLERROR];
const char* old_value = *dlerror_slot;
*dlerror_slot = new_value;