about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/htl
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-11 10:35:10 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-11 20:41:25 +0000
commit9cec82de715b3ffc625a6c67d107a3fcb26af566 (patch)
treee66429ab410d9ef1510ac702a39ec439e956742f /sysdeps/mach/hurd/htl
parentd482ebfa67850976485fdf061cd52427eb8a3cb7 (diff)
downloadglibc-9cec82de715b3ffc625a6c67d107a3fcb26af566.tar.gz
glibc-9cec82de715b3ffc625a6c67d107a3fcb26af566.tar.xz
glibc-9cec82de715b3ffc625a6c67d107a3fcb26af566.zip
htl: Initialize later
Since htl does not actually need a stack switch, we can initialize it
like nptl is, avoiding all sorts of startup issues with ifunc.

More precisely, htl defines __pthread_initialize_minimal instead of the
elder _cthread_init_routine. We can then drop the stack switching dances.
Diffstat (limited to 'sysdeps/mach/hurd/htl')
-rw-r--r--sysdeps/mach/hurd/htl/pt-sysdep.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c
index 0963b44878..8ca549dd73 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.c
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.c
@@ -28,13 +28,6 @@
 
 __thread struct __pthread *___pthread_self;
 
-/* Forward.  */
-static void *init_routine (void);
-
-/* OK, the name of this variable isn't really appropriate, but I don't
-   want to change it yet.  */
-void *(*_cthread_init_routine) (void) = &init_routine;
-
 static void
 reset_pthread_total (void)
 {
@@ -45,7 +38,7 @@ reset_pthread_total (void)
 /* This function is called from the Hurd-specific startup code.  It
    should return a new stack pointer for the main thread.  The caller
    will switch to this new stack before doing anything serious.  */
-static void *
+static void
 _init_routine (void *stack)
 {
   struct __pthread *thread;
@@ -54,7 +47,7 @@ _init_routine (void *stack)
 
   if (__pthread_threads != NULL)
     /* Already initialized */
-    return 0;
+    return;
 
   /* Initialize the library.  */
   ___pthread_init ();
@@ -96,14 +89,12 @@ _init_routine (void *stack)
 
   /* Make MiG code thread aware.  */
   __mig_init (thread->stackaddr);
-
-  return thread->mcontext.sp;
 }
 
-static void *
-init_routine (void)
+void
+__pthread_initialize_minimal (void)
 {
-  return _init_routine (0);
+  _init_routine (__libc_stack_end);
 }
 
 #ifdef SHARED