From 8a26ad2ab7396bc94fd3cd7b25cba433908d30e1 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 20 Dec 2017 11:40:36 +0100 Subject: nptl: Implement pthread_self in libc.so [BZ #22635] All binaries use TLS and thus need a properly set up TCB, so we can simply return its address directly, instead of forwarding to the libpthread implementation from libc. For versioned symbols, the dynamic linker checks that the soname matches the name supplied by the link editor, so a compatibility symbol in libpthread is needed. To avoid linking against the libpthread function in all cases, we would have to bump the symbol version of libpthread in libc.so and supply a compat symbol. This commit does not do that because the function implementation is so small, so the overhead by two active copies of the same function might well be smaller than the increase in symbol table size. --- nptl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nptl/Makefile') diff --git a/nptl/Makefile b/nptl/Makefile index 60d036a1ea..ab8cc98728 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -31,7 +31,7 @@ install-lib-ldscripts := libpthread.so routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \ libc-cleanup libc_pthread_init libc_multiple_threads \ - register-atfork unregister-atfork + register-atfork unregister-atfork pthread_self shared-only-routines = forward # We need to provide certain routines for compatibility with existing @@ -49,7 +49,7 @@ pthread-compat-wrappers = \ libpthread-routines = nptl-init vars events version pt-interp \ pthread_create pthread_exit pthread_detach \ pthread_join pthread_tryjoin pthread_timedjoin \ - pthread_self pthread_equal pthread_yield \ + compat-pthread_self pthread_equal pthread_yield \ pthread_getconcurrency pthread_setconcurrency \ pthread_getschedparam pthread_setschedparam \ pthread_setschedprio \ -- cgit v1.2.3