[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r7382 - in /branches/eglibc-2_9/ports: ChangeLog.eglibc sysdeps/arm/tls-macros.h



Author: joseph
Date: Thu Nov 20 09:28:32 2008
New Revision: 7382

Log:
	* sysdeps/arm/tls-macros.h (ARM_PC_OFFSET): Define.
	(TLS_IE): Define differently for Thumb-2.
	(TLS_LE, TLS_LD, TLS_GD): Use ARM_PC_OFFSET.

Modified:
    branches/eglibc-2_9/ports/ChangeLog.eglibc
    branches/eglibc-2_9/ports/sysdeps/arm/tls-macros.h

Modified: branches/eglibc-2_9/ports/ChangeLog.eglibc
==============================================================================
--- branches/eglibc-2_9/ports/ChangeLog.eglibc (original)
+++ branches/eglibc-2_9/ports/ChangeLog.eglibc Thu Nov 20 09:28:32 2008
@@ -1,3 +1,9 @@
+2008-11-20  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/arm/tls-macros.h (ARM_PC_OFFSET): Define.
+	(TLS_IE): Define differently for Thumb-2.
+	(TLS_LE, TLS_LD, TLS_GD): Use ARM_PC_OFFSET.
+
 2008-11-20  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c

Modified: branches/eglibc-2_9/ports/sysdeps/arm/tls-macros.h
==============================================================================
--- branches/eglibc-2_9/ports/sysdeps/arm/tls-macros.h (original)
+++ branches/eglibc-2_9/ports/sysdeps/arm/tls-macros.h Thu Nov 20 09:28:32 2008
@@ -1,3 +1,9 @@
+#ifdef __thumb2__
+#define ARM_PC_OFFSET "4"
+#else
+#define ARM_PC_OFFSET "8"
+#endif
+
 #define TLS_LE(x)					\
   ({ int *__result;					\
      void *tp = __builtin_thread_pointer ();		\
@@ -10,6 +16,21 @@
 	  : "=&r" (__result) : "r" (tp));		\
      __result; })
 
+#ifdef __thumb2__
+#define TLS_IE(x)					\
+  ({ int *__result;					\
+     void *tp = __builtin_thread_pointer ();		\
+     asm ("ldr %0, 1f; "				\
+	  "3: add %0, pc, %0;"				\
+	  "ldr %0, [%0];"				\
+	  "add %0, %1, %0; "				\
+	  "b 2f; "					\
+	  ".align 2; "					\
+	  "1: .word " #x "(gottpoff) + (. - 3b - 4); "	\
+	  "2: "						\
+	  : "=&r" (__result) : "r" (tp));		\
+     __result; })
+#else
 #define TLS_IE(x)					\
   ({ int *__result;					\
      void *tp = __builtin_thread_pointer ();		\
@@ -22,6 +43,7 @@
 	  "2: "						\
 	  : "=&r" (__result) : "r" (tp));		\
      __result; })
+#endif
 
 #define TLS_LD(x)					\
   ({ char *__result;					\
@@ -31,7 +53,7 @@
 	  "1: add %0, pc, %0; "				\
 	  "b 3f; "					\
 	  ".align 2; "					\
-	  "2: .word " #x "(tlsldm) + (. - 1b - 8); "	\
+	  "2: .word " #x "(tlsldm) + (. - 1b - "ARM_PC_OFFSET"); "	\
 	  "3: "						\
 	  : "=r" (__result));				\
      __result = (char *)__tls_get_addr (__result);	\
@@ -50,7 +72,7 @@
 	  "1: add %0, pc, %0; "				\
 	  "b 3f; "					\
 	  ".align 2; "					\
-	  "2: .word " #x "(tlsgd) + (. - 1b - 8); "	\
+	  "2: .word " #x "(tlsgd) + (. - 1b - "ARM_PC_OFFSET"); "	\
 	  "3: "						\
 	  : "=r" (__result));				\
      (int *)__tls_get_addr (__result); })