summaryrefslogtreecommitdiff
path: root/nptl/pthread_self.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-12-20 11:40:36 +0100
committerFlorian Weimer <fweimer@redhat.com>2017-12-20 11:42:04 +0100
commit8a26ad2ab7396bc94fd3cd7b25cba433908d30e1 (patch)
tree3e87bff8b59daaa5c7564532cc48c8d53ee5f7db /nptl/pthread_self.c
parent5069ff32842c60c55f8b573ee66fe43f9ec364af (diff)
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.
Diffstat (limited to 'nptl/pthread_self.c')
-rw-r--r--nptl/pthread_self.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/nptl/pthread_self.c b/nptl/pthread_self.c
index 8e21775e31..b75af9358e 100644
--- a/nptl/pthread_self.c
+++ b/nptl/pthread_self.c
@@ -19,10 +19,8 @@
#include "pthreadP.h"
#include <tls.h>
-
pthread_t
-__pthread_self (void)
+pthread_self (void)
{
return (pthread_t) THREAD_SELF;
}
-weak_alias (__pthread_self, pthread_self)