summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-03-06 03:42:54 +0000
committergonzo <gonzo@FreeBSD.org>2012-03-06 03:42:54 +0000
commit8e4a44e740c28f43409ae42c1cd5ff741f6b6720 (patch)
tree7d56d152910d1f51bbf2f378ae288495f1446e60 /lib
parentece21645a2c9e9413d1746abdbd9e3009d2a975d (diff)
downloadFreeBSD-src-8e4a44e740c28f43409ae42c1cd5ff741f6b6720.zip
FreeBSD-src-8e4a44e740c28f43409ae42c1cd5ff741f6b6720.tar.gz
- Switch ARM and MIPS to TLS Variant I
- Fix TLS allocation for Variant I: both rtld and libc allocators assume that tls_static_space includes space for TLS structure. So increment calculated static size by the size of it.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/tls.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index 9d84679..abae57a 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -66,11 +66,11 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
#error TLS_TCB_ALIGN undefined for target architecture
#endif
-#if defined(__ia64__) || defined(__powerpc__)
+#if defined(__arm__) || defined(__ia64__) || defined(__mips__) || \
+ defined(__powerpc__)
#define TLS_VARIANT_I
#endif
-#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \
- defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__)
#define TLS_VARIANT_II
#endif
@@ -308,6 +308,13 @@ _init_tls()
}
}
+#ifdef TLS_VARIANT_I
+ /*
+ * tls_static_space should include space for TLS structure
+ */
+ tls_static_space += TLS_TCB_SIZE;
+#endif
+
tls = _rtld_allocate_tls(NULL, TLS_TCB_SIZE, TLS_TCB_ALIGN);
_set_tp(tls);
OpenPOWER on IntegriCloud