This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 09/10] alpha: Add tls-macros.h.


---
 ChangeLog.alpha            |    2 ++
 sysdeps/alpha/tls-macros.h |   25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 sysdeps/alpha/tls-macros.h

diff --git a/ChangeLog.alpha b/ChangeLog.alpha
index 8ade582..804dd64 100644
--- a/ChangeLog.alpha
+++ b/ChangeLog.alpha
@@ -1,5 +1,7 @@
 2012-02-08  Richard Henderson  <rth@twiddle.net>
 
+	* sysdeps/alpha/tls-macros.h: New file.
+
 	* sysdeps/unix/sysv/linux/alpha/getitimer.S: Don't check HAVE_ELF.
 	* sysdeps/unix/sysv/linux/alpha/getrusage.S: Likewise.
 	* sysdeps/unix/sysv/linux/alpha/gettimeofday.S: Likewise.
diff --git a/sysdeps/alpha/tls-macros.h b/sysdeps/alpha/tls-macros.h
new file mode 100644
index 0000000..0385d93
--- /dev/null
+++ b/sysdeps/alpha/tls-macros.h
@@ -0,0 +1,25 @@
+/* Macros to support TLS testing in times of missing compiler support.  */
+
+extern void *__tls_get_addr (void *);
+
+# define TLS_GD(x)						\
+  ({ void *__result;						\
+     asm ("lda %0, " #x "($gp) !tlsgd" : "=r" (__result));	\
+     __tls_get_addr (__result); })
+
+# define TLS_LD(x)						\
+  ({ void *__result;						\
+     asm ("lda %0, " #x "($gp) !tlsldm" : "=r" (__result));	\
+     __result = __tls_get_addr (__result);			\
+     asm ("lda %0, " #x "(%0) !dtprel" : "+r" (__result));	\
+     __result; })
+
+# define TLS_IE(x)						\
+  ({ long ofs;							\
+     asm ("ldq %0, " #x "($gp) !gottprel" : "=r"(ofs));		\
+     __builtin_thread_pointer () + ofs; })
+
+# define TLS_LE(x)						\
+  ({ void *__result = __builtin_thread_pointer ();		\
+     asm ("lda %0, " #x "(%0) !tprel" : "+r" (__result));	\
+     __result; })
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]