about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index f8d9597cdd..8367398e64 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -41,6 +41,7 @@
 #include <tls.h>
 #include <stap-probe.h>
 #include <stackinfo.h>
+#include <pthread-pids.h>
 
 #include <assert.h>
 
@@ -741,6 +742,14 @@ cannot allocate TLS data structures for initial thread\n");
     _dl_fatal_printf ("cannot set up thread-local storage: %s\n", lossage);
   tls_init_tp_called = true;
 
+  /* Initialize only as much of the initial thread's descriptor as is
+     necessary even when libpthread is not loaded.  More will be done
+     by __pthread_initialize_minimal if libpthread is loaded.  This
+     needs to happen before anything that could possibly call raise,
+     but cannot happen before TLS is initialized.  */
+  struct pthread *pd = THREAD_SELF;
+  __pthread_initialize_pids (pd);
+
   return tcbp;
 }