diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-04-21 11:50:43 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-04-30 08:32:03 +0200 |
commit | ea299b62e83cc38b0d910bbd1a879f7d1f836e96 (patch) | |
tree | a446e513c9e79c1d5215a89a9700ae3b33c68f78 /nptl/pthread_create.c | |
parent | 162df872f0dfc2b124a18e1a8c33be63f70d9a1c (diff) | |
download | glibc-ea299b62e83cc38b0d910bbd1a879f7d1f836e96.tar.gz glibc-ea299b62e83cc38b0d910bbd1a879f7d1f836e96.tar.xz glibc-ea299b62e83cc38b0d910bbd1a879f7d1f836e96.zip |
nptl_db: Support different libpthread/ld.so load orders (bug 27744)
libthread_db is loaded once GDB encounters libpthread, and at this point, ld.so may not have been processed by GDB yet. As a result, _rtld_global cannot be accessed by regular means from libthread_db. To make this work until GDB can be fixed, acess _rtld_global through a pointer stored in libpthread. The new test does not reproduce bug 27744 with --disable-hardcoded-path-in-tests, but is still a valid smoke test. With --enable-hardcoded-path-in-tests, it is necessary to avoid add-symbol-file because this can tickle a GDB bug. Fixes commit 1daccf403b1bd86370eb94edca794dc106d02039 ("nptl: Move stack list variables into _rtld_global"). Tested-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit a64afc225240b2b27129ccfb0516d7c958b98040)
Diffstat (limited to 'nptl/pthread_create.c')
-rw-r--r-- | nptl/pthread_create.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 6c645aff48..f13d8e44a4 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -51,6 +51,14 @@ static td_thr_events_t __nptl_threads_events __attribute_used__; /* Pointer to descriptor with the last event. */ static struct pthread *__nptl_last_event __attribute_used__; +#ifdef SHARED +/* This variable is used to access _rtld_global from libthread_db. If + GDB loads libpthread before ld.so, it is not possible to resolve + _rtld_global directly during libpthread initialization. */ +static struct rtld_global *__nptl_rtld_global __attribute_used__ + = &_rtld_global; +#endif + /* Number of threads running. */ unsigned int __nptl_nthreads = 1; |