about summary refs log tree commit diff
path: root/nptl/init.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-12-13 07:32:19 +0000
committerRoland McGrath <roland@gnu.org>2005-12-13 07:32:19 +0000
commitb399707ead1bf45eb9c59fbaee04e0587d68ed58 (patch)
treebe934aab9df8da164a18646224b5207054cbed3d /nptl/init.c
parentdb13ddbcfa1e8fb7c58a0022893aef8a8921fd4f (diff)
downloadglibc-b399707ead1bf45eb9c59fbaee04e0587d68ed58.tar.gz
glibc-b399707ead1bf45eb9c59fbaee04e0587d68ed58.tar.xz
glibc-b399707ead1bf45eb9c59fbaee04e0587d68ed58.zip
2005-12-12 Roland McGrath <roland@redhat.com>
	* init.c (__pthread_initialize_minimal_internal): Do __static_tls_size
	adjustments before choosing stack size.  Update minimum stack size
	calculation to match allocate_stack change.
Diffstat (limited to 'nptl/init.c')
-rw-r--r--nptl/init.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/nptl/init.c b/nptl/init.c
index 6a7fff9959..1f79eba62a 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -289,6 +289,17 @@ __pthread_initialize_minimal_internal (void)
   (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask,
 			   NULL, _NSIG / 8);
 
+  /* Get the size of the static and alignment requirements for the TLS
+     block.  */
+  size_t static_tls_align;
+  _dl_get_tls_static_info (&__static_tls_size, &static_tls_align);
+
+  /* Make sure the size takes all the alignments into account.  */
+  if (STACK_ALIGN > static_tls_align)
+    static_tls_align = STACK_ALIGN;
+  __static_tls_align_m1 = static_tls_align - 1;
+
+  __static_tls_size = roundup (__static_tls_size, static_tls_align);
 
   /* Determine the default allowed stack size.  This is the size used
      in case the user does not specify one.  */
@@ -306,7 +317,7 @@ __pthread_initialize_minimal_internal (void)
   /* Make sure it meets the minimum size that allocate_stack
      (allocatestack.c) will demand, which depends on the page size.  */
   const uintptr_t pagesz = __sysconf (_SC_PAGESIZE);
-  const size_t minstack = pagesz * 2 + __static_tls_size + MINIMAL_REST_STACK;
+  const size_t minstack = pagesz + __static_tls_size + MINIMAL_REST_STACK;
   if (limit.rlim_cur < minstack)
     limit.rlim_cur = minstack;
 
@@ -314,18 +325,6 @@ __pthread_initialize_minimal_internal (void)
   limit.rlim_cur = (limit.rlim_cur + pagesz - 1) & -pagesz;
   __default_stacksize = limit.rlim_cur;
 
-  /* Get the size of the static and alignment requirements for the TLS
-     block.  */
-  size_t static_tls_align;
-  _dl_get_tls_static_info (&__static_tls_size, &static_tls_align);
-
-  /* Make sure the size takes all the alignments into account.  */
-  if (STACK_ALIGN > static_tls_align)
-    static_tls_align = STACK_ALIGN;
-  __static_tls_align_m1 = static_tls_align - 1;
-
-  __static_tls_size = roundup (__static_tls_size, static_tls_align);
-
 #ifdef SHARED
   /* Transfer the old value from the dynamic linker's internal location.  */
   *__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) ();