git: rtld - Support static TLS bindings for late-loaded shared libraries
Matthew Dillon
dillon at crater.dragonflybsd.org
Fri Aug 9 15:31:49 PDT 2019
commit eeb6957159b8d414a4ad6de31c473c8cd565972b
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Fri Aug 9 15:22:18 2019 -0700
rtld - Support static TLS bindings for late-loaded shared libraries
* Allow late (manual) dlopen()s to load shared libraries which
use static TLS variables, as long as there is space. Do proper
late-binding and initialize the area for all threads.
* rtld will cache a symbol lookup on first-need for:
"_pthread_distribute_static_tls" and then call it as needed to
initialize late-bound static TLS space.
This symbol is weakly bounded to __libc_distribute_static_tls in libc,
and strongly overridden by _libthread_distribute_static_tls in
libthread_xu.
* Fixes mesa glx-tls and others.
* Test code from FreeBSD. Also tested with other combinations
including a pthread_create() and -static compilation.
https://github.com/dumbbell/test-tls-initial-exec
Summary of changes:
include/dlfcn.h | 1 +
lib/libc/gen/Symbol.map | 1 +
lib/libc/gen/elf_utils.c | 18 +++++++
lib/libc/include/libc_private.h | 3 ++
lib/libthread_xu/pthread.map | 1 +
lib/libthread_xu/thread/Makefile.inc | 1 +
lib/libthread_xu/thread/thr_distribute.c | 44 ++++++++++++++++
libexec/rtld-elf/rtld.c | 86 +++++++++++++++++++++++++++-----
libexec/rtld-elf/rtld.h | 2 +
9 files changed, 144 insertions(+), 13 deletions(-)
create mode 100644 lib/libthread_xu/thread/thr_distribute.c
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/eeb6957159b8d414a4ad6de31c473c8cd565972b
--
DragonFly BSD source repository
More information about the Commits
mailing list