summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/sh/libc-tls.c
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2010-12-06 15:37:37 +0100
committerCarmelo Amoroso <carmelo.amoroso@st.com>2010-12-06 15:37:37 +0100
commitd181797c70183b897330a290e6f5f5d7e7812770 (patch)
tree09a3b2919e5b126ff95515a0bcb7916e22bcfb71 /libpthread/nptl/sysdeps/sh/libc-tls.c
parent57f6cce72c889f2e7b342e87a565a064320a6ee2 (diff)
parente2903ddb06b1f50cb4ac9af0b035c74ed6b9d30f (diff)
Merge commit 'origin/master' into prelink
Diffstat (limited to 'libpthread/nptl/sysdeps/sh/libc-tls.c')
-rw-r--r--libpthread/nptl/sysdeps/sh/libc-tls.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/libpthread/nptl/sysdeps/sh/libc-tls.c b/libpthread/nptl/sysdeps/sh/libc-tls.c
new file mode 100644
index 000000000..7b3389503
--- /dev/null
+++ b/libpthread/nptl/sysdeps/sh/libc-tls.c
@@ -0,0 +1,31 @@
+/*
+ * Thread-local storage handling in statically linked binaries. SH 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.
+ * Author: Filippo Arcidiacono <filippo.arcidiacono@st.com>
+ *
+ * Licensed under the LGPL v2.1, 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 SH, 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