diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-11-16 19:33:30 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-11-16 19:33:30 +0100 |
commit | 1daccf403b1bd86370eb94edca794dc106d02039 (patch) | |
tree | e54bc8ee71eb92b7114df79e2f378a477c470029 /elf/rtld.c | |
parent | aac0f62c47beee5b546bacc330acc2dd21cda0dc (diff) | |
download | glibc-1daccf403b1bd86370eb94edca794dc106d02039.tar.gz glibc-1daccf403b1bd86370eb94edca794dc106d02039.tar.xz glibc-1daccf403b1bd86370eb94edca794dc106d02039.zip |
nptl: Move stack list variables into _rtld_global
Now __thread_gscope_wait (the function behind THREAD_GSCOPE_WAIT, formerly __wait_lookup_done) can be implemented directly in ld.so, eliminating the unprotected GL (dl_wait_lookup_done) function pointer. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/rtld.c')
-rw-r--r-- | elf/rtld.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index 5d117d0d2c..c4ffc8d4b7 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -48,6 +48,7 @@ #include <array_length.h> #include <libc-early-init.h> #include <dl-main.h> +#include <list.h> #include <assert.h> @@ -799,6 +800,9 @@ cannot allocate TLS data structures for initial thread\n"); const char *lossage = TLS_INIT_TP (tcbp); if (__glibc_unlikely (lossage != NULL)) _dl_fatal_printf ("cannot set up thread-local storage: %s\n", lossage); +#if THREAD_GSCOPE_IN_TCB + list_add (&THREAD_SELF->list, &GL (dl_stack_user)); +#endif tls_init_tp_called = true; return tcbp; @@ -1139,6 +1143,11 @@ dl_main (const ElfW(Phdr) *phdr, GL(dl_rtld_unlock_recursive) = rtld_lock_default_unlock_recursive; #endif +#if THREAD_GSCOPE_IN_TCB + INIT_LIST_HEAD (&GL (dl_stack_used)); + INIT_LIST_HEAD (&GL (dl_stack_user)); +#endif + /* The explicit initialization here is cheaper than processing the reloc in the _rtld_local definition's initializer. */ GL(dl_make_stack_executable_hook) = &_dl_make_stack_executable; @@ -2383,6 +2392,9 @@ dl_main (const ElfW(Phdr) *phdr, if (__glibc_unlikely (lossage != NULL)) _dl_fatal_printf ("cannot set up thread-local storage: %s\n", lossage); +#if THREAD_GSCOPE_IN_TCB + list_add (&THREAD_SELF->list, &GL (dl_stack_user)); +#endif } /* Make sure no new search directories have been added. */ |