about summary refs log tree commit diff
path: root/sysdeps/alpha/tls-macros.h
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2014-02-12 06:54:57 -0800
committerRichard Henderson <rth@twiddle.net>2014-02-12 07:00:06 -0800
commit68b7efaadb1b6045a56277ea62d324c20ac0b633 (patch)
tree07b51c9866373430373fb90b252d46c23cc1707e /sysdeps/alpha/tls-macros.h
parent8fd7b0d5591e59ed5cb3078b351bd49314a66cef (diff)
downloadglibc-68b7efaadb1b6045a56277ea62d324c20ac0b633.tar.gz
glibc-68b7efaadb1b6045a56277ea62d324c20ac0b633.tar.xz
glibc-68b7efaadb1b6045a56277ea62d324c20ac0b633.zip
Relocate alpha from ports to libc
Also fixed the following whitespace nits to satisfy the push:

sysdeps/alpha/alphaev6/memset.S:142: space before tab in indent.
sysdeps/alpha/configure:1: new blank line at EOF.
sysdeps/alpha/fpu/e_sqrt.c:126: space before tab in indent.
sysdeps/alpha/preconfigure:1: new blank line at EOF.
sysdeps/unix/sysv/linux/alpha/syscalls.list:1: new blank line at EOF.
Diffstat (limited to 'sysdeps/alpha/tls-macros.h')
-rw-r--r--sysdeps/alpha/tls-macros.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/sysdeps/alpha/tls-macros.h b/sysdeps/alpha/tls-macros.h
new file mode 100644
index 0000000000..00489c289f
--- /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)							\
+  ({ register void *__gp asm ("$29"); void *__result;			\
+     asm ("lda %0, " #x "($gp) !tlsgd" : "=r" (__result) : "r"(__gp));	\
+     __tls_get_addr (__result); })
+
+# define TLS_LD(x)							\
+  ({ register void *__gp asm ("$29"); void *__result;			\
+     asm ("lda %0, " #x "($gp) !tlsldm" : "=r" (__result) : "r"(__gp));	\
+     __result = __tls_get_addr (__result);				\
+     asm ("lda %0, " #x "(%0) !dtprel" : "+r" (__result));		\
+     __result; })
+
+# define TLS_IE(x)							\
+  ({ register void *__gp asm ("$29"); long ofs;				\
+     asm ("ldq %0, " #x "($gp) !gottprel" : "=r"(ofs) : "r"(__gp));	\
+     __builtin_thread_pointer () + ofs; })
+
+# define TLS_LE(x)						\
+  ({ void *__result = __builtin_thread_pointer ();		\
+     asm ("lda %0, " #x "(%0) !tprel" : "+r" (__result));	\
+     __result; })