summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/metag/libc-tls.c
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2010-11-18 14:58:01 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2013-03-14 22:47:08 +0100
commitdaecc9a410a6f23d80daf8ce3afd280fea329e63 (patch)
tree8d603dd538809431cc01b9e656c827d1f0709052 /libpthread/nptl/sysdeps/metag/libc-tls.c
parent20221281b3d67880439cd1d16c151f4528d034fb (diff)
metag: Add NPTL support
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libpthread/nptl/sysdeps/metag/libc-tls.c')
-rw-r--r--libpthread/nptl/sysdeps/metag/libc-tls.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/libpthread/nptl/sysdeps/metag/libc-tls.c b/libpthread/nptl/sysdeps/metag/libc-tls.c
new file mode 100644
index 000000000..abc7c58db
--- /dev/null
+++ b/libpthread/nptl/sysdeps/metag/libc-tls.c
@@ -0,0 +1,33 @@
+/*
+ * Thread-local storage handling in statically linked binaries. Meta version.
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * Based on GNU C Library (file: libc/sysdeps/sh/libc-tls.c)
+ *
+ * Copyright (C) 2010 STMicroelectronics Ltd.
+ * Copyright (C) 2013 Imagination Technologies Ltd.
+ *
+ * Author: Filippo Arcidiacono <filippo.arcidiacono@st.com>
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ *
+ */
+
+#include <sysdeps/generic/libc-tls.c>
+#include <dl-tls.h>
+
+#if defined (USE_TLS) && (USE_TLS)
+
+/* On Meta, linker optimizations are not required, so __tls_get_addr
+ can be called even in statically linked binaries. In this case module
+ must be always 1 and PT_TLS segment exist in the binary, otherwise it
+ would not link. */
+
+void *
+__tls_get_addr (tls_index *ti)
+{
+ dtv_t *dtv = THREAD_DTV ();
+ return (char *) dtv[1].pointer.val + ti->ti_offset;
+}
+
+#endif