about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-12-04 04:20:07 +0000
committerRoland McGrath <roland@gnu.org>2002-12-04 04:20:07 +0000
commite7e6e437daf42e323ba981ef53fbb3e5362d4a3f (patch)
treee9f4766ef0a8af9973e85e0afdf3d38612d8cc7f
parent69cae3cfaffd9b605d1a42a80498dd4f39fef824 (diff)
downloadglibc-e7e6e437daf42e323ba981ef53fbb3e5362d4a3f.tar.gz
glibc-e7e6e437daf42e323ba981ef53fbb3e5362d4a3f.tar.xz
glibc-e7e6e437daf42e323ba981ef53fbb3e5362d4a3f.zip
2002-12-03 Roland McGrath <roland@redhat.com>
	* sysdeps/generic/libc-tls.c (__libc_setup_tls): Include static TLS
	area surplus in calculation for sbrk call.
-rw-r--r--sysdeps/generic/libc-tls.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c
index a403e95065..a6a0504f44 100644
--- a/sysdeps/generic/libc-tls.c
+++ b/sysdeps/generic/libc-tls.c
@@ -106,15 +106,22 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
     /* We do not need a TLS block and no thread descriptor.  */
     return;
 
+
   /* We have to set up the TCB block which also (possibly) contains
      'errno'.  Therefore we avoid 'malloc' which might touch 'errno'.
      Instead we use 'sbrk' which would only uses 'errno' if it fails.
      In this case we are right away out of memory and the user gets
-     what she/he deserves.  */
+     what she/he deserves.
+
+     The initialized value of _dl_tls_static_size is provided by dl-open.c
+     to request some surplus that permits dynamic loading of modules with
+     IE-model TLS.  */
 # if TLS_TCB_AT_TP
-  tlsblock = __sbrk (roundup (memsz, tcbalign) + tcbsize + max_align);
+  tlsblock = __sbrk (roundup (memsz, tcbalign) + tcbsize + max_align
+		     + GL(dl_tls_static_size));
 # elif TLS_DTV_AT_TP
-  tlsblock = __sbrk (roundup (tcbsize, align) + memsz + max_align);
+  tlsblock = __sbrk (roundup (tcbsize, align) + memsz + max_align
+		     + GL(dl_tls_static_size));
 # else
   /* In case a model with a different layout for the TCB and DTV
      is defined add another #elif here and in the following #ifs.  */