diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-05-10 10:31:41 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-05-10 10:31:41 +0200 |
commit | d017b0ab5a181dce4145f3a1b3b27e3341abd201 (patch) | |
tree | cfe65201d70b7df83848838256d2c7288dcee67b /sysdeps/nptl | |
parent | 0df5d8d404fbf6a7802737b0f9d32ab3376cec86 (diff) | |
download | glibc-d017b0ab5a181dce4145f3a1b3b27e3341abd201.tar.gz glibc-d017b0ab5a181dce4145f3a1b3b27e3341abd201.tar.xz glibc-d017b0ab5a181dce4145f3a1b3b27e3341abd201.zip |
elf: Introduce __tls_pre_init_tp
This is an early variant of __tls_init_tp, primarily for initializing thread-related elements of _rtld_global/GL. Some existing initialization code not needed for NPTL is moved into the generic version of this function. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/nptl')
-rw-r--r-- | sysdeps/nptl/dl-tls_init_tp.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c index 05d2b6cfcc..cb29222727 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -27,12 +27,33 @@ bool __nptl_set_robust_list_avail __attribute__ ((nocommon)); rtld_hidden_data_def (__nptl_set_robust_list_avail) #endif +#ifdef SHARED +/* Dummy implementation. See __rtld_mutex_init. */ +static int +rtld_mutex_dummy (pthread_mutex_t *lock) +{ + return 0; +} +#endif + void -__tls_init_tp (void) +__tls_pre_init_tp (void) { - /* Set up thread stack list management. */ + /* The list data structures are not consistent until + initialized. */ INIT_LIST_HEAD (&GL (dl_stack_used)); INIT_LIST_HEAD (&GL (dl_stack_user)); + +#ifdef SHARED + ___rtld_mutex_lock = rtld_mutex_dummy; + ___rtld_mutex_unlock = rtld_mutex_dummy; +#endif +} + +void +__tls_init_tp (void) +{ + /* Set up thread stack list management. */ list_add (&THREAD_SELF->list, &GL (dl_stack_user)); /* Early initialization of the TCB. */ |