Merge "Clean up the remnants of SuperH support"
diff --git a/libc/arch-arm/include/machine/asm.h b/libc/arch-arm/include/machine/asm.h
index 7b8f053..047e54d 100644
--- a/libc/arch-arm/include/machine/asm.h
+++ b/libc/arch-arm/include/machine/asm.h
@@ -97,6 +97,12 @@
 #define	ASENTRY_NP(y)	_ENTRY(_ASM_LABEL(y))
 #define	ASEND(y)	_END(_ASM_LABEL(y))
 
+#ifdef __ELF__
+#define ENTRY_PRIVATE(y)  ENTRY(y); .hidden _C_LABEL(y)
+#else
+#define ENTRY_PRIVATE(y)  ENTRY(y)
+#endif
+
 #define	ASMSTR		.asciz
 
 #if defined(__ELF__) && defined(PIC)
diff --git a/libc/arch-x86/bionic/__set_tls.c b/libc/arch-x86/bionic/__set_tls.c
index e5e43b5..7ed4b01 100755
--- a/libc/arch-x86/bionic/__set_tls.c
+++ b/libc/arch-x86/bionic/__set_tls.c
@@ -83,6 +83,7 @@
     if (rc != 0)
     {
         /* could not set thread local area */
+        pthread_mutex_unlock(&_tls_desc_lock);
         return -1;
     }
 
diff --git a/libc/arch-x86/include/machine/asm.h b/libc/arch-x86/include/machine/asm.h
index 7a23060..49d3ea8 100644
--- a/libc/arch-x86/include/machine/asm.h
+++ b/libc/arch-x86/include/machine/asm.h
@@ -103,6 +103,12 @@
 #define _ENTRY(x) \
 	.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
 
+#define _ASM_SIZE(x)    .size x, .-x;
+
+#define _END(x) \
+	.fnend; \
+	_ASM_SIZE(x)
+
 #ifdef GPROF
 # define _PROF_PROLOGUE	\
 	pushl %ebp; movl %esp,%ebp; call PIC_PLT(mcount); popl %ebp
@@ -112,8 +118,12 @@
 
 #define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
 #define	NENTRY(y)	_ENTRY(_C_LABEL(y))
+#define	END(y)		_END(_C_LABEL(y))
 #define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 
+#define ENTRY_PRIVATE(y)  ENTRY(y); .hidden _C_LABEL(y)
+
+
 #define	ALTENTRY(name)	.globl _C_LABEL(name); _C_LABEL(name):
 
 #define	ASMSTR		.asciz
diff --git a/libc/include/sys/cdefs_elf.h b/libc/include/sys/cdefs_elf.h
index 1e57470..0887fa5 100644
--- a/libc/include/sys/cdefs_elf.h
+++ b/libc/include/sys/cdefs_elf.h
@@ -96,9 +96,24 @@
 #endif
 
 /* GCC visibility helper macro */
+/* This must be used to tag non-static functions that are private, i.e.
+ * never exposed by the shared library. */
 #define __LIBC_HIDDEN__							\
 	__attribute__ ((visibility ("hidden")))
 
+/* This must be used to tag non-static functions that are public, i.e.
+ * exposed by the shared library, and part of the stable NDK ABI */
+#define __LIBC_ABI_PUBLIC__ \
+        __attribute__ ((visibility ("default")))
+
+/* This must be used to tag non-static functions that must be exported
+ * by the shared library, but whose implementation is private to the
+ * platform. For now this is equivalent to __LIBC_ABI_PUBLIC__, but we
+ * may want to change this later.
+ */
+#define __LIBC_ABI_PRIVATE__ \
+        __attribute__ ((visibility ("default")))
+
 #define	__IDSTRING(_n,_s)		__SECTIONSTRING(.ident,_s)
 
 #define	__RCSID(_s)			__IDSTRING(rcsid,_s)
diff --git a/libm/src/s_logb.c b/libm/src/s_logb.c
index 30edb87..57f91c4 100644
--- a/libm/src/s_logb.c
+++ b/libm/src/s_logb.c
@@ -36,9 +36,9 @@
 	if(ix>=0x7ff00000) return x*x;
 	if(ix<0x00100000) {
 		x *= two54;		 /* convert subnormal x to normal */
-		GET_FLOAT_WORD(ix,x);
+		GET_HIGH_WORD(ix,x);
 		ix &= 0x7fffffff;
-		return (float) ((ix>>20)-1023-54);
+		return (double) ((ix>>20)-1023-54);
 	} else
 		return (double) ((ix>>20)-1023);
 }
diff --git a/linker/dlfcn.c b/linker/dlfcn.c
index 5964bd1..194a4ae 100644
--- a/linker/dlfcn.c
+++ b/linker/dlfcn.c
@@ -42,7 +42,7 @@
 #define likely(expr)   __builtin_expect (expr, 1)
 #define unlikely(expr) __builtin_expect (expr, 0)
 
-static pthread_mutex_t dl_lock = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t dl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
 
 static void set_dlerror(int err)
 {