about summary refs log tree commit diff
path: root/sysdeps/aarch64/tls-macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/aarch64/tls-macros.h')
-rw-r--r--sysdeps/aarch64/tls-macros.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/sysdeps/aarch64/tls-macros.h b/sysdeps/aarch64/tls-macros.h
index 33883dca40..d1048d8958 100644
--- a/sysdeps/aarch64/tls-macros.h
+++ b/sysdeps/aarch64/tls-macros.h
@@ -32,8 +32,9 @@
 	    "x30", "memory", "cc");			\
      (int *) (__result); })
 
-#define TLS_IE(x)					\
-  ({ register unsigned long __result asm ("x0");	\
+#ifdef __LP64__
+# define TLS_IE(x)					\
+  ({ register unsigned long __result;			\
      register unsigned long __t;			\
      asm ("mrs	%1, tpidr_el0; "			\
 	  "adrp	%0, :gottprel:" #x "; "			\
@@ -41,6 +42,17 @@
 	  "add	%0, %0, %1"				\
 	  : "=r" (__result), "=r" (__t));		\
      (int *) (__result); })
+#else
+# define TLS_IE(x)					\
+  ({ register unsigned long __result;			\
+     register unsigned long __t;			\
+     asm ("mrs	%1, tpidr_el0; "			\
+	  "adrp	%0, :gottprel:" #x "; "			\
+	  "ldr	%w0, [%0, #:gottprel_lo12:" #x "]; "	\
+	  "add	%0, %0, %1"				\
+	  : "=r" (__result), "=r" (__t));		\
+     (int *) (__result); })
+#endif
 
 #define TLS_LE(x)					\
   ({ register unsigned long __result asm ("x0");	\