This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.26.9000-1024-g8a26ad2
- From: fw at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 20 Dec 2017 10:54:48 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.26.9000-1024-g8a26ad2
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 8a26ad2ab7396bc94fd3cd7b25cba433908d30e1 (commit)
from 5069ff32842c60c55f8b573ee66fe43f9ec364af (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8a26ad2ab7396bc94fd3cd7b25cba433908d30e1
commit 8a26ad2ab7396bc94fd3cd7b25cba433908d30e1
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Dec 20 11:40:36 2017 +0100
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.
diff --git a/ChangeLog b/ChangeLog
index 982798c..de2ee3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2017-12-20 Florian Weimer <fweimer@redhat.com>
+
+ [BZ #22635]
+ nptl: Provide full implementation of pthread_self in libc.so.
+ * nptl/Makefile (routines): Add pthread_self.
+ (libpthread-routines): Replace pthread_self with
+ compat-pthread_self.
+ * nptl/forward.c (pthread_self): Remove.
+ * nptl/nptl-init.c (pthread_functions): Do not initialize
+ ptr_pthread_self.
+ * nptl/pthread_self.c (pthread_self): Remove weak alias.
+ * nptl/compat-pthread_self.c: New file.
+ * sysdeps/nptl/pthread-functions.h (struct pthread_functions):
+ Remove ptr_pthread_self.
+
2017-12-19 Arnold D. Robbins <arnold@skeeve.com>
* posix/regcomp.c: Fix spelling in comments.
diff --git a/nptl/Makefile b/nptl/Makefile
index 60d036a..ab8cc98 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 \
diff --git a/nptl/pthread_self.c b/nptl/compat-pthread_self.c
similarity index 64%
copy from nptl/pthread_self.c
copy to nptl/compat-pthread_self.c
index 8e21775..5e9f4eb 100644
--- a/nptl/pthread_self.c
+++ b/nptl/compat-pthread_self.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2002-2017 Free Software Foundation, Inc.
+/* Compatibility version of pthread_self in libpthread.
+ Copyright (C) 2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,13 +16,12 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "pthreadP.h"
-#include <tls.h>
+/* Compatibility version of pthread_self for old binaries which link
+ directly against libpthread's version. */
+#include <shlib-compat.h>
-pthread_t
-__pthread_self (void)
-{
- return (pthread_t) THREAD_SELF;
-}
-weak_alias (__pthread_self, pthread_self)
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_27)
+# include "pthread_self.c"
+compat_symbol (libpthread, pthread_self, pthread_self, GLIBC_2_0);
+#endif
diff --git a/nptl/forward.c b/nptl/forward.c
index ac96765..8abbccd 100644
--- a/nptl/forward.c
+++ b/nptl/forward.c
@@ -193,10 +193,6 @@ FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
-
-FORWARD2 (pthread_self, pthread_t, (void), (), return 0)
-
-
FORWARD (__pthread_setcancelstate, (int state, int *oldstate),
(state, oldstate), 0)
strong_alias (__pthread_setcancelstate, pthread_setcancelstate)
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 869e926..a5979f2 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -122,7 +122,6 @@ static const struct pthread_functions pthread_functions =
.ptr_pthread_mutex_init = __pthread_mutex_init,
.ptr_pthread_mutex_lock = __pthread_mutex_lock,
.ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
- .ptr_pthread_self = __pthread_self,
.ptr___pthread_setcancelstate = __pthread_setcancelstate,
.ptr_pthread_setcanceltype = __pthread_setcanceltype,
.ptr___pthread_cleanup_upto = __pthread_cleanup_upto,
diff --git a/nptl/pthread_self.c b/nptl/pthread_self.c
index 8e21775..b75af93 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)
diff --git a/sysdeps/nptl/pthread-functions.h b/sysdeps/nptl/pthread-functions.h
index 4006fc6..4af2142 100644
--- a/sysdeps/nptl/pthread-functions.h
+++ b/sysdeps/nptl/pthread-functions.h
@@ -74,7 +74,6 @@ struct pthread_functions
const pthread_mutexattr_t *);
int (*ptr_pthread_mutex_lock) (pthread_mutex_t *);
int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *);
- pthread_t (*ptr_pthread_self) (void);
int (*ptr___pthread_setcancelstate) (int, int *);
int (*ptr_pthread_setcanceltype) (int, int *);
void (*ptr___pthread_cleanup_upto) (__jmp_buf, char *);
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 15 +++++++++++++++
nptl/Makefile | 4 ++--
.../compat-pthread_self.c | 20 ++++++++------------
nptl/forward.c | 4 ----
nptl/nptl-init.c | 1 -
nptl/pthread_self.c | 4 +---
sysdeps/nptl/pthread-functions.h | 1 -
7 files changed, 26 insertions(+), 23 deletions(-)
copy sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S => nptl/compat-pthread_self.c (71%)
hooks/post-receive
--
GNU C Library master sources