about summary refs log tree commit diff
path: root/ports/sysdeps/alpha/tls-macros.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-07-01 13:06:41 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-07-01 13:06:41 +0000
commite64ac02c24b43659048622714afdc92fedf561fa (patch)
tree37162878b72d302de351788bec4c9360c9d55f1d /ports/sysdeps/alpha/tls-macros.h
parenta20c2b3c87aebc7d4b090c622d36480263b80042 (diff)
downloadglibc-e64ac02c24b43659048622714afdc92fedf561fa.tar.gz
glibc-e64ac02c24b43659048622714afdc92fedf561fa.tar.xz
glibc-e64ac02c24b43659048622714afdc92fedf561fa.zip
Move all files into ports/ subdirectory in preparation for merge with glibc glibc-2.16-ports-before-merge
Diffstat (limited to 'ports/sysdeps/alpha/tls-macros.h')
-rw-r--r--ports/sysdeps/alpha/tls-macros.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/ports/sysdeps/alpha/tls-macros.h b/ports/sysdeps/alpha/tls-macros.h
new file mode 100644
index 0000000000..0385d93e2a
--- /dev/null
+++ b/ports/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; })