summaryrefslogtreecommitdiff
path: root/nptl/allocatestack.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r--nptl/allocatestack.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index c56a4df12c..c044b205c8 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -353,7 +353,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
struct pthread *pd;
size_t size;
size_t pagesize_m1 = __getpagesize () - 1;
- void *stacktop;
assert (powerof2 (pagesize_m1 + 1));
assert (TCB_ALIGNMENT >= STACK_ALIGN);
@@ -717,19 +716,23 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
/* 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