ce426f
diff -pruN glibc-2.17-c758a686/nptl/Makefile glibc-2.17-c758a686/nptl/Makefile
ce426f
--- glibc-2.17-c758a686/nptl/Makefile	2013-07-31 11:51:24.882747234 +0530
ce426f
+++ glibc-2.17-c758a686/nptl/Makefile	2013-07-31 11:58:55.964731526 +0530
ce426f
@@ -276,10 +276,7 @@ gen-as-const-headers = pthread-errnos.sy
ce426f
 
ce426f
 LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
ce426f
 
ce426f
-# The size is 1MB + 4KB.  The extra 4KB has been added to prevent allocatestack
ce426f
-# from resizing the input size to avoid the 64K aliasing conflict on Intel
ce426f
-# processors.
ce426f
-DEFAULT_STACKSIZE=1052672
ce426f
+DEFAULT_STACKSIZE=1048576
ce426f
 CFLAGS-tst-default-attr.c = -DDEFAULT_STACKSIZE=$(DEFAULT_STACKSIZE)
ce426f
 tst-default-attr-ENV = GLIBC_PTHREAD_STACKSIZE=$(DEFAULT_STACKSIZE)
ce426f
 
ce426f
diff -pruN glibc-2.17-c758a686/nptl/tst-default-attr.c glibc-2.17-c758a686/nptl/tst-default-attr.c
ce426f
--- glibc-2.17-c758a686/nptl/tst-default-attr.c	2013-07-31 11:51:24.885747234 +0530
ce426f
+++ glibc-2.17-c758a686/nptl/tst-default-attr.c	2013-07-31 12:18:10.016691337 +0530
ce426f
@@ -38,6 +38,7 @@
ce426f
 
ce426f
 /* DEFAULT_STACKSIZE macro is defined in the Makefile.  */
ce426f
 static size_t stacksize = DEFAULT_STACKSIZE;
ce426f
+long int pagesize;
ce426f
 
ce426f
 static int
ce426f
 verify_stacksize_result (pthread_attr_t *attr)
ce426f
@@ -46,12 +47,20 @@ verify_stacksize_result (pthread_attr_t
ce426f
 
ce426f
   RETURN_IF_FAIL (pthread_attr_getstacksize, attr, &stack);
ce426f
 
ce426f
-  if (stacksize != stack)
ce426f
+  /* pthread_create perturbs the stack size by a page if it aligns to 64K to
ce426f
+     avoid the 64K aliasing conflict.  We cannot simply add 4K to the size in
ce426f
+     the Makefile because it breaks the test on powerpc since the page size
ce426f
+     there is 64K, resulting in a resize in __pthread_initialize_minimal.
ce426f
+     Hence, our check is to ensure that the stack size is not more than a page
ce426f
+     more than the requested size.  */
ce426f
+  if (stack < stacksize || stack > stacksize + pagesize)
ce426f
     {
ce426f
       printf ("failed to set default stacksize (%zu, %zu)\n", stacksize, stack);
ce426f
       return 1;
ce426f
     }
ce426f
 
ce426f
+  printf ("Requested %zu and got %zu\n", stacksize, stack);
ce426f
+
ce426f
   return 0;
ce426f
 }
ce426f
 
ce426f
@@ -101,6 +110,15 @@ run_threads (void)
ce426f
 static int
ce426f
 do_test (void)
ce426f
 {
ce426f
+  pthread_attr_t attr;
ce426f
+
ce426f
+  pagesize = sysconf (_SC_PAGESIZE);
ce426f
+  if (pagesize < 0)
ce426f
+    {
ce426f
+      printf ("sysconf failed: %s\n", strerror (errno));
ce426f
+      return 1;
ce426f
+    }
ce426f
+
ce426f
   RETURN_IF_FAIL (run_threads);
ce426f
   return 0;
ce426f
 }