summaryrefslogtreecommitdiff
path: root/arch/arm/pthread_arch.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/pthread_arch.h')
-rw-r--r--arch/arm/pthread_arch.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/arm/pthread_arch.h b/arch/arm/pthread_arch.h
index 8b8a7fb6..197752ef 100644
--- a/arch/arm/pthread_arch.h
+++ b/arch/arm/pthread_arch.h
@@ -10,15 +10,17 @@ static inline pthread_t __pthread_self()
#else
-static inline pthread_t __pthread_self()
-{
-#ifdef __clang__
- char *p;
- __asm__ __volatile__ ( "bl __a_gettp\n\tmov %0,r0" : "=r"(p) : : "cc", "r0", "lr" );
+#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
+#define BLX "mov lr,pc\n\tbx"
#else
- register char *p __asm__("r0");
- __asm__ __volatile__ ( "bl __a_gettp" : "=r"(p) : : "cc", "lr" );
+#define BLX "blx"
#endif
+
+static inline pthread_t __pthread_self()
+{
+ extern uintptr_t __attribute__((__visibility__("hidden"))) __a_gettp_ptr;
+ register uintptr_t p __asm__("r0");
+ __asm__ __volatile__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" );
return (void *)(p+8-sizeof(struct pthread));
}