On arches that set _STACK_GROWS_UP, the stacktop variable is declared
and set, but never actually used. Refactor the code a bit so that the
variable is only declared/set under _STACK_GROWS_DOWN settings.
+2015-08-05 Mike Frysinger <vapier@gentoo.org>
+
+ * nptl/allocatestack.c (allocate_stack): Move stacktop decl down to
+ bottom and under _STACK_GROWS_DOWN. Move the stacktop assignment
+ in there too.
+
2015-08-05 Carlos O'Donell <carlos@systemhalted.org>
* version.h (RELEASE): Set to "development".
struct pthread *pd;
size_t size;
size_t pagesize_m1 = __getpagesize () - 1;
- void *stacktop;
assert (powerof2 (pagesize_m1 + 1));
assert (TCB_ALIGNMENT >= STACK_ALIGN);
/* We place the thread descriptor at the end of the stack. */
*pdp = pd;
-#if TLS_TCB_AT_TP
+#if _STACK_GROWS_DOWN
+ void *stacktop;
+
+# if TLS_TCB_AT_TP
/* The stack begins before the TCB and the static TLS block. */
stacktop = ((char *) (pd + 1) - __static_tls_size);
-#elif TLS_DTV_AT_TP
+# elif TLS_DTV_AT_TP
stacktop = (char *) (pd - 1);
-#endif
+# endif
-#ifdef NEED_SEPARATE_REGISTER_STACK
+# ifdef NEED_SEPARATE_REGISTER_STACK
*stack = pd->stackblock;
*stacksize = stacktop - *stack;
-#elif _STACK_GROWS_DOWN
+# else
*stack = stacktop;
-#elif _STACK_GROWS_UP
+# endif
+#else
*stack = pd->stackblock;
assert (*stack > 0);
#endif