about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/htl/pt-sysdep.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-07 23:27:46 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-07 23:36:40 +0000
commitaf27fabe405c757d372b106c8aa383a386a4a79e (patch)
treecd019d303cfa25d12637c46c4bd109f82e819032 /sysdeps/mach/hurd/htl/pt-sysdep.c
parent3944c61bdf5d1530d0576a396eb3e2f9a4d6caff (diff)
downloadglibc-af27fabe405c757d372b106c8aa383a386a4a79e.tar.gz
glibc-af27fabe405c757d372b106c8aa383a386a4a79e.tar.xz
glibc-af27fabe405c757d372b106c8aa383a386a4a79e.zip
htl: Fix tls initialization for already-created threads
* sysdeps/htl/pthreadP.h: Include <link.h>
(__pthread_init_static_tls): New prototype.
* htl/pt-alloc.c (__pthread_init_static_tls): New function.
* sysdeps/mach/hurd/htl/pt-sysdep.c (_init_routine): Initialize tcb
field of initial thread. Set GL(dl_init_static_tls) to
&__pthread_init_static_tls.
Diffstat (limited to 'sysdeps/mach/hurd/htl/pt-sysdep.c')
-rw-r--r--sysdeps/mach/hurd/htl/pt-sysdep.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c
index 84d191475d..0963b44878 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.c
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.c
@@ -77,6 +77,7 @@ _init_routine (void *stack)
      to the new stack.  Pretend it wasn't allocated so that it remains
      valid if the main thread terminates.  */
   thread->stack = 0;
+  thread->tcb = THREAD_SELF;
 
 #ifndef PAGESIZE
   __pthread_default_attr.__guardsize = __vm_page_size;
@@ -91,6 +92,8 @@ _init_routine (void *stack)
 
   __pthread_atfork (NULL, NULL, reset_pthread_total);
 
+  GL(dl_init_static_tls) = &__pthread_init_static_tls;
+
   /* Make MiG code thread aware.  */
   __mig_init (thread->stackaddr);