aboutsummaryrefslogtreecommitdiff
path: root/nptl/allocatestack.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-25 09:12:43 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-25 09:12:43 +0000
commit299601a1ef8df4532ded24194c4556e294ab1e6e (patch)
tree7e7338ca0004ce7fdba3e7429677ef0a5786ad8f /nptl/allocatestack.c
parent29bfc9453e2945b476cec5545f8409fd2a2ba886 (diff)
downloadglibc-299601a1ef8df4532ded24194c4556e294ab1e6e.zip
glibc-299601a1ef8df4532ded24194c4556e294ab1e6e.tar.gz
glibc-299601a1ef8df4532ded24194c4556e294ab1e6e.tar.bz2
Update.
2003-04-22 Jakub Jelinek <jakub@redhat.com> * include/link.h (NO_TLS_OFFSET): Define to 0 if not defined. * elf/dl-close.c (_dl_close): Use NO_TLS_OFFSET. * elf/dl-object.c (_dl_new_object): Initialize l_tls_offset to NO_TLS_OFFSET. * elf/rtld.c (_dl_start_final, _dl_start): Likewise. * elf/dl-reloc.c (CHECK_STATIC_TLS): Use NO_TLS_OFFSET. * sysdeps/generic/dl-tls.c (_dl_allocate_tls_init): Likewise. * sysdeps/powerpc/dl-tls.h (TLS_TPREL_VALUE): Don't subtract TLS_TCB_SIZE.
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r--nptl/allocatestack.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index c199cf2..c6b89d8 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -81,7 +81,7 @@
#if TLS_TCB_AT_TP
# define TLS_TPADJ(pd) (pd)
#elif TLS_DTV_AT_TP
-# define TLS_TPADJ(pd) ((pd) + 1)
+# define TLS_TPADJ(pd) ((struct pthread *)((char *) (pd) + TLS_PRE_TCB_SIZE))
#endif
/* Cache handling for not-yet free stacks. */
@@ -296,8 +296,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
pd = (struct pthread *) ((uintptr_t) attr->stackaddr
- TLS_TCB_SIZE - adj);
#elif TLS_DTV_AT_TP
- pd = (struct pthread *) ((uintptr_t) attr->stackaddr
- - __static_tls_size - adj) - 1;
+ pd = (struct pthread *) (((uintptr_t) attr->stackaddr
+ - __static_tls_size - adj)
+ - TLS_PRE_TCB_SIZE);
#endif
/* The user provided stack memory needs to be cleared. */
@@ -321,7 +322,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
/* This is at least the second thread. */
- pd->header.multiple_threads = 1;
+ p_multiple_threads (pd) = 1;
#else
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
#endif
@@ -426,9 +427,10 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
#if TLS_TCB_AT_TP
pd = (struct pthread *) ((char *) mem + size - coloring) - 1;
#elif TLS_DTV_AT_TP
- pd = (struct pthread *) (((uintptr_t) mem + size - coloring
+ pd = (struct pthread *) ((((uintptr_t) mem + size - coloring
- __static_tls_size)
- & ~__static_tls_align_m1) - 1;
+ & ~__static_tls_align_m1)
+ - TLS_PRE_TCB_SIZE);
#endif
/* Remember the stack-related values. */
@@ -447,7 +449,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
/* This is at least the second thread. */
- pd->header.multiple_threads = 1;
+ p_multiple_threads (pd) = 1;
#else
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
#endif