about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-10-27 11:36:44 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-10-27 11:36:44 +0200
commita65ff76c9a1811dd2396ab45563f645579c0e687 (patch)
tree2b0dc70922fa0fc9f2c472145ecece35e7bb85aa /elf/rtld.c
parent77db67c56b24bba3c735aac34a6f796c909b68c0 (diff)
downloadglibc-a65ff76c9a1811dd2396ab45563f645579c0e687.tar.gz
glibc-a65ff76c9a1811dd2396ab45563f645579c0e687.tar.xz
glibc-a65ff76c9a1811dd2396ab45563f645579c0e687.zip
ld.so: Export tls_init_tp_called as __rtld_tls_init_tp_called
This allows the rest of dynamic loader to check whether the TCB
has been set up (and THREAD_GETMEM and THREAD_SETMEM will work).

Reviewed-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 3b78f40562..221be5c71e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -730,7 +730,7 @@ match_version (const char *string, struct link_map *map)
   return 0;
 }
 
-static bool tls_init_tp_called;
+bool __rtld_tls_init_tp_called;
 
 static void *
 init_tls (size_t naudit)
@@ -800,7 +800,7 @@ cannot allocate TLS data structures for initial thread\n");
   if (__glibc_unlikely (lossage != NULL))
     _dl_fatal_printf ("cannot set up thread-local storage: %s\n", lossage);
   __tls_init_tp ();
-  tls_init_tp_called = true;
+  __rtld_tls_init_tp_called = true;
 
   return tcbp;
 }
@@ -2050,7 +2050,7 @@ dl_main (const ElfW(Phdr) *phdr,
      an old kernel that can't perform TLS_INIT_TP, even if no TLS is ever
      used.  Trying to do it lazily is too hairy to try when there could be
      multiple threads (from a non-TLS-using libpthread).  */
-  bool was_tls_init_tp_called = tls_init_tp_called;
+  bool was_tls_init_tp_called = __rtld_tls_init_tp_called;
   if (tcbp == NULL)
     tcbp = init_tls (0);
 
@@ -2321,7 +2321,7 @@ dl_main (const ElfW(Phdr) *phdr,
 			       consider_profiling);
 
 	/* Add object to slot information data if necessasy.  */
-	if (l->l_tls_blocksize != 0 && tls_init_tp_called)
+	if (l->l_tls_blocksize != 0 && __rtld_tls_init_tp_called)
 	  _dl_add_to_slotinfo (l, true);
       }
   }
@@ -2347,7 +2347,7 @@ dl_main (const ElfW(Phdr) *phdr,
   _dl_allocate_tls_init (tcbp, false);
 
   /* And finally install it for the main thread.  */
-  if (! tls_init_tp_called)
+  if (! __rtld_tls_init_tp_called)
     {
       const char *lossage = TLS_INIT_TP (tcbp);
       if (__glibc_unlikely (lossage != NULL))