diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-05-05 06:20:31 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-05-05 06:20:31 +0200 |
commit | 7cbf1c8416b04c65dc3d253061d8a674ee3c616e (patch) | |
tree | e931adb0174f9f4ce64f4dfa97c6fcd489f0fc12 /sysdeps/generic/ldsodefs.h | |
parent | 2c71177309cc59788c2288c6033c9dbbd23f02c3 (diff) | |
download | glibc-7cbf1c8416b04c65dc3d253061d8a674ee3c616e.zip glibc-7cbf1c8416b04c65dc3d253061d8a674ee3c616e.tar.gz glibc-7cbf1c8416b04c65dc3d253061d8a674ee3c616e.tar.bz2 |
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 'sysdeps/generic/ldsodefs.h')
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 67c6686..1b064c5 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -464,7 +464,9 @@ struct rtld_global /* Generation counter for the dtv. */ EXTERN size_t _dl_tls_generation; +#if !THREAD_GSCOPE_IN_TCB EXTERN void (*_dl_init_static_tls) (struct link_map *); +#endif /* Scopes to free after next THREAD_GSCOPE_WAIT (). */ EXTERN struct dl_scope_free_list @@ -1270,6 +1272,23 @@ extern void _dl_non_dynamic_init (void) extern void _dl_aux_init (ElfW(auxv_t) *av) attribute_hidden; +/* Initialize the static TLS space for the link map in all existing + threads. */ +#if THREAD_GSCOPE_IN_TCB +void _dl_init_static_tls (struct link_map *map) attribute_hidden; +#endif +static inline void +dl_init_static_tls (struct link_map *map) +{ +#if THREAD_GSCOPE_IN_TCB + /* The stack list is available to ld.so, so the initialization can + be handled within ld.so directly. */ + _dl_init_static_tls (map); +#else + GL (dl_init_static_tls) (map); +#endif +} + /* Return true if the ld.so copy in this namespace is actually active and working. If false, the dl_open/dlfcn hooks have to be used to call into the outer dynamic linker (which happens after static |