about summary refs log tree commit diff
path: root/elf/dl-reloc.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-05 06:20:31 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-05 06:20:31 +0200
commit7cbf1c8416b04c65dc3d253061d8a674ee3c616e (patch)
treee931adb0174f9f4ce64f4dfa97c6fcd489f0fc12 /elf/dl-reloc.c
parent2c71177309cc59788c2288c6033c9dbbd23f02c3 (diff)
downloadglibc-7cbf1c8416b04c65dc3d253061d8a674ee3c616e.tar.gz
glibc-7cbf1c8416b04c65dc3d253061d8a674ee3c616e.tar.xz
glibc-7cbf1c8416b04c65dc3d253061d8a674ee3c616e.zip
elf, nptl: Initialize static TLS directly in ld.so
The stack list is available in ld.so since commit
1daccf403b1bd86370eb94edca794dc106d02039 ("nptl: Move stack list
variables into _rtld_global"), so it's possible to walk the stack
list directly in ld.so and perform the initialization there.

This eliminates an unprotected function pointer from _rtld_global
and reduces the libpthread initialization code.
Diffstat (limited to 'elf/dl-reloc.c')
-rw-r--r--elf/dl-reloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index c2df26deea..bb9ca1a101 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -118,7 +118,7 @@ _dl_try_allocate_static_tls (struct link_map *map, bool optional)
 	(void) _dl_update_slotinfo (map->l_tls_modid);
 #endif
 
-      GL(dl_init_static_tls) (map);
+      dl_init_static_tls (map);
     }
   else
     map->l_need_tls_init = 1;
@@ -141,6 +141,7 @@ cannot allocate memory in static TLS block"));
     }
 }
 
+#if !THREAD_GSCOPE_IN_TCB
 /* Initialize static TLS area and DTV for current (only) thread.
    libpthread implementations should provide their own hook
    to handle all threads.  */
@@ -159,7 +160,7 @@ _dl_nothread_init_static_tls (struct link_map *map)
   memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
 	  '\0', map->l_tls_blocksize - map->l_tls_initimage_size);
 }
-
+#endif /* !THREAD_GSCOPE_IN_TCB */
 
 void
 _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],