Fix stack initialization code
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Wed, 28 Jan 2009 02:17:49 +0000 (21:17 -0500)
committerDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Wed, 28 Jan 2009 02:17:49 +0000 (21:17 -0500)
nptl/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pthreaddef.h
sysdeps/unix/sysv/solaris2/kopensolaris-gnu/init-first.c

index f143f32..bedd148 100644 (file)
@@ -45,8 +45,7 @@ extern void sigaction_atfork (void);
       {                                             \
         pd->stackblock = _stack->ss_sp;             \
         pd->stackblock_size = _stack->ss_size;      \
-      }                                             \
-    PLATFORM_THREAD_START
+      }
 
 /* Additional descr fields.  */
 # define PLATFORM_DESCR_FIELDS  \
index d6b8773..0e585b9 100644 (file)
@@ -80,11 +80,17 @@ _init (int argc, char **argv, char **envp)
       if (getrlimit (RLIMIT_STACK, &rlim) == 0 &&
           rlim.rlim_cur != RLIM_INFINITY && getcontext (&ctx) == 0)
         {
-          _dl_stack.ss_sp = ctx.uc_stack.ss_sp;
+          _dl_stack.ss_sp = ctx.uc_stack.ss_sp +
+              ctx.uc_stack.ss_size - rlim.rlim_cur;
           _dl_stack.ss_size = rlim.rlim_cur;
-          _dl_stack.ss_flags = 0;
-          setustack (&_dl_stack);
         }
+      else
+        {
+          _dl_stack.ss_sp = ctx.uc_stack.ss_sp;
+          _dl_stack.ss_size = 0;
+        }
+      _dl_stack.ss_flags = 0;
+      setustack (&_dl_stack);
     }
 
   /* Save the command-line arguments.  */