summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-11 11:08:00 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-11 11:24:39 +0200
commitddd4a2d3c64642b34d95743db9032c2bb31c16b2 (patch)
treebfa7fb0ef9b4ba4cbf7412960ab665be2503db0c /nptl
parentdf65f897e9501aa5b64a5cbcb101301715f2ec2f (diff)
downloadglibc-ddd4a2d3c64642b34d95743db9032c2bb31c16b2.tar.gz
glibc-ddd4a2d3c64642b34d95743db9032c2bb31c16b2.tar.xz
glibc-ddd4a2d3c64642b34d95743db9032c2bb31c16b2.zip
nptl: Move thread join functions into libc
The symbols pthread_clockjoin_np, pthread_join, pthread_timedjoin_np,
pthread_tryjoin_np, thrd_join were moved using
scripts/move-symbol-to-libc.py.

Moving the symbols at the same time avoids the need for temporary
exports.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile10
-rw-r--r--nptl/Versions18
-rw-r--r--nptl/libpthread-compat.c5
-rw-r--r--nptl/pthreadP.h5
-rw-r--r--nptl/pthread_clockjoin.c27
-rw-r--r--nptl/pthread_join.c13
-rw-r--r--nptl/pthread_timedjoin.c22
-rw-r--r--nptl/pthread_tryjoin.c8
8 files changed, 77 insertions, 31 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index 5e0347b5b1..f81b2f64df 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -84,6 +84,7 @@ routines = \
   pthread_barrierattr_init \
   pthread_barrierattr_setpshared \
   pthread_cleanup_upto \
+  pthread_clockjoin \
   pthread_cond_broadcast \
   pthread_cond_destroy \
   pthread_cond_init \
@@ -102,6 +103,8 @@ routines = \
   pthread_getattr_np \
   pthread_getschedparam \
   pthread_getspecific \
+  pthread_join \
+  pthread_join_common \
   pthread_key_create \
   pthread_key_delete \
   pthread_keys \
@@ -161,6 +164,8 @@ routines = \
   pthread_spin_trylock \
   pthread_spin_unlock \
   pthread_testcancel \
+  pthread_timedjoin \
+  pthread_tryjoin \
   pthread_yield \
   sem_clockwait \
   sem_close \
@@ -197,21 +202,16 @@ libpthread-routines = \
   pthread_attr_setstackaddr \
   pthread_attr_setstacksize \
   pthread_cancel \
-  pthread_clockjoin \
   pthread_create \
   pthread_getattr_default_np \
   pthread_getconcurrency \
   pthread_getcpuclockid \
   pthread_getname \
-  pthread_join \
-  pthread_join_common \
   pthread_setaffinity \
   pthread_setconcurrency \
   pthread_setname \
   pthread_setschedprio \
   pthread_sigqueue \
-  pthread_timedjoin \
-  pthread_tryjoin \
   version \
 
 libpthread-shared-only-routines = \
diff --git a/nptl/Versions b/nptl/Versions
index 46ae34a1a2..8c3e825083 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -42,6 +42,7 @@ libc {
     pthread_exit;
     pthread_getschedparam;
     pthread_getspecific;
+    pthread_join;
     pthread_key_create;
     pthread_key_delete;
     pthread_kill;
@@ -148,6 +149,8 @@ libc {
     pthread_condattr_getclock;
     pthread_condattr_setclock;
     pthread_getaffinity_np;
+    pthread_timedjoin_np;
+    pthread_tryjoin_np;
   }
   GLIBC_2.3.4 {
     pthread_attr_setaffinity_np;
@@ -190,6 +193,7 @@ libc {
     thrd_detach;
     thrd_equal;
     thrd_exit;
+    thrd_join;
     thrd_sleep;
     thrd_yield;
     tss_create;
@@ -204,6 +208,9 @@ libc {
     pthread_rwlock_clockwrlock;
     sem_clockwait;
   }
+  GLIBC_2.31 {
+    pthread_clockjoin_np;
+  }
   GLIBC_2.32 {
     pthread_attr_getsigmask_np;
     pthread_attr_setaffinity_np;
@@ -237,6 +244,7 @@ libc {
     pthread_barrierattr_getpshared;
     pthread_barrierattr_init;
     pthread_barrierattr_setpshared;
+    pthread_clockjoin_np;
     pthread_cond_clockwait;
     pthread_condattr_getclock;
     pthread_condattr_getpshared;
@@ -244,6 +252,7 @@ libc {
     pthread_condattr_setpshared;
     pthread_detach;
     pthread_getspecific;
+    pthread_join;
     pthread_key_create;
     pthread_key_delete;
     pthread_kill;
@@ -287,6 +296,8 @@ libc {
     pthread_spin_trylock;
     pthread_spin_unlock;
     pthread_testcancel;
+    pthread_timedjoin_np;
+    pthread_tryjoin_np;
     sem_clockwait;
     sem_close;
     sem_destroy;
@@ -300,6 +311,7 @@ libc {
     sem_wait;
     thrd_detach;
     thrd_exit;
+    thrd_join;
     tss_create;
     tss_delete;
     tss_get;
@@ -369,7 +381,6 @@ libpthread {
     funlockfile;
     pthread_cancel;
     pthread_create;
-    pthread_join;
     pthread_sigmask;
   }
 
@@ -421,8 +432,6 @@ libpthread {
     __pthread_unregister_cancel_restore;
     pthread_attr_getaffinity_np;
     pthread_setaffinity_np;
-    pthread_timedjoin_np;
-    pthread_tryjoin_np;
   }
 
   GLIBC_2.3.4 {
@@ -452,7 +461,6 @@ libpthread {
   # C11 thread symbols.
   GLIBC_2.28 {
     thrd_create;
-    thrd_join;
   }
 
   GLIBC_2.30 {
@@ -460,7 +468,7 @@ libpthread {
   }
 
   GLIBC_2.31 {
-    pthread_clockjoin_np;
+    __libpthread_version_placeholder;
   }
 
   GLIBC_PRIVATE {
diff --git a/nptl/libpthread-compat.c b/nptl/libpthread-compat.c
index 401fa6ad34..bc9ee36df0 100644
--- a/nptl/libpthread-compat.c
+++ b/nptl/libpthread-compat.c
@@ -69,3 +69,8 @@ compat_symbol (libpthread, __libpthread_version_placeholder_1,
 compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_30);
 #endif
+
+#if (SHLIB_COMPAT (libpthread, GLIBC_2_31, GLIBC_2_32))
+compat_symbol (libpthread, __libpthread_version_placeholder_1,
+	       __libpthread_version_placeholder, GLIBC_2_31);
+#endif
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 34d133b187..7e3cef4709 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -456,10 +456,10 @@ libc_hidden_proto (__pthread_cond_wait)
 extern int __pthread_clockjoin_np64 (pthread_t threadid, void **thread_return,
                                      clockid_t clockid,
                                      const struct __timespec64 *abstime);
-libpthread_hidden_proto (__pthread_clockjoin_np64)
+libc_hidden_proto (__pthread_clockjoin_np64)
 extern int __pthread_timedjoin_np64 (pthread_t threadid, void **thread_return,
                                      const struct __timespec64 *abstime);
-libpthread_hidden_proto (__pthread_timedjoin_np64)
+libc_hidden_proto (__pthread_timedjoin_np64)
 extern int __pthread_cond_timedwait64 (pthread_cond_t *cond,
                                        pthread_mutex_t *mutex,
                                        const struct __timespec64 *abstime);
@@ -535,6 +535,7 @@ extern int __pthread_kill (pthread_t threadid, int signo);
 extern void __pthread_exit (void *value) __attribute__ ((__noreturn__));
 libc_hidden_proto (__pthread_exit)
 extern int __pthread_join (pthread_t threadid, void **thread_return);
+libc_hidden_proto (__pthread_join)
 extern int __pthread_setcanceltype (int type, int *oldtype);
 libc_hidden_proto (__pthread_setcanceltype)
 extern void __pthread_testcancel (void);
diff --git a/nptl/pthread_clockjoin.c b/nptl/pthread_clockjoin.c
index 7457c187fe..f5007d7831 100644
--- a/nptl/pthread_clockjoin.c
+++ b/nptl/pthread_clockjoin.c
@@ -19,10 +19,12 @@
 #include <time.h>
 #include <futex-internal.h>
 #include "pthreadP.h"
+#include <shlib-compat.h>
 
 int
-__pthread_clockjoin_np64 (pthread_t threadid, void **thread_return,
-                          clockid_t clockid, const struct __timespec64 *abstime)
+___pthread_clockjoin_np64 (pthread_t threadid, void **thread_return,
+			   clockid_t clockid,
+			   const struct __timespec64 *abstime)
 {
   if (!futex_abstimed_supported_clockid (clockid))
     return EINVAL;
@@ -31,12 +33,14 @@ __pthread_clockjoin_np64 (pthread_t threadid, void **thread_return,
                                  clockid, abstime, true);
 }
 
-#if __TIMESIZE != 64
-libpthread_hidden_def (__pthread_clockjoin_np64)
+#if __TIMESIZE == 64
+strong_alias (___pthread_clockjoin_np64, ___pthread_clockjoin_np)
+#else /* __TIMESPEC64 != 64 */
+libc_hidden_ver (___pthread_clockjoin_np64, __pthread_clockjoin_np64)
 
 int
-__pthread_clockjoin_np (pthread_t threadid, void **thread_return,
-                        clockid_t clockid, const struct timespec *abstime)
+___pthread_clockjoin_np (pthread_t threadid, void **thread_return,
+			 clockid_t clockid, const struct timespec *abstime)
 {
   if (abstime != NULL)
     {
@@ -45,8 +49,13 @@ __pthread_clockjoin_np (pthread_t threadid, void **thread_return,
 				       &ts64);
     }
   else
-      return __pthread_clockjoin_np64 (threadid, thread_return, clockid,
-				       NULL);
+    return __pthread_clockjoin_np64 (threadid, thread_return, clockid,
+				     NULL);
 }
+#endif /* __TIMESPEC64 != 64 */
+versioned_symbol (libc, ___pthread_clockjoin_np, pthread_clockjoin_np,
+		  GLIBC_2_34);
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_31, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_clockjoin_np, pthread_clockjoin_np,
+	       GLIBC_2_31);
 #endif
-weak_alias (__pthread_clockjoin_np, pthread_clockjoin_np)
diff --git a/nptl/pthread_join.c b/nptl/pthread_join.c
index 4ad718e606..d2b33de73d 100644
--- a/nptl/pthread_join.c
+++ b/nptl/pthread_join.c
@@ -17,11 +17,20 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include "pthreadP.h"
+#include <shlib-compat.h>
 
 int
-__pthread_join (pthread_t threadid, void **thread_return)
+___pthread_join (pthread_t threadid, void **thread_return)
 {
   return __pthread_clockjoin_ex (threadid, thread_return, 0 /* Ignored */,
 				 NULL, true);
 }
-weak_alias (__pthread_join, pthread_join)
+versioned_symbol (libc, ___pthread_join, pthread_join, GLIBC_2_34);
+libc_hidden_ver (___pthread_join, __pthread_join)
+#ifndef SHARED
+strong_alias (___pthread_join, __pthread_join)
+#endif
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libc, ___pthread_join, pthread_join, GLIBC_2_0);
+#endif
diff --git a/nptl/pthread_timedjoin.c b/nptl/pthread_timedjoin.c
index f5d0d3d6ce..ebc31f935a 100644
--- a/nptl/pthread_timedjoin.c
+++ b/nptl/pthread_timedjoin.c
@@ -18,21 +18,24 @@
 
 #include <time.h>
 #include "pthreadP.h"
+#include <shlib-compat.h>
 
 int
-__pthread_timedjoin_np64 (pthread_t threadid, void **thread_return,
-                          const struct __timespec64 *abstime)
+___pthread_timedjoin_np64 (pthread_t threadid, void **thread_return,
+                           const struct __timespec64 *abstime)
 {
   return __pthread_clockjoin_ex (threadid, thread_return,
                                  CLOCK_REALTIME, abstime, true);
 }
 
-#if __TIMESIZE != 64
-libpthread_hidden_def (__pthread_timedjoin_np64)
+#if __TIMESIZE == 64
+strong_alias (___pthread_timedjoin_np64, ___pthread_timedjoin_np)
+#else /* __TIMESPEC64 != 64 */
+libc_hidden_ver (___pthread_timedjoin_np64, __pthread_timedjoin_np64)
 
 int
-__pthread_timedjoin_np (pthread_t threadid, void **thread_return,
-                        const struct timespec *abstime)
+  ___pthread_timedjoin_np (pthread_t threadid, void **thread_return,
+                           const struct timespec *abstime)
 {
   if (abstime != NULL)
     {
@@ -42,5 +45,10 @@ __pthread_timedjoin_np (pthread_t threadid, void **thread_return,
   else
     return __pthread_timedjoin_np64 (threadid, thread_return, NULL);
 }
+#endif /* __TIMESPEC64 != 64 */
+versioned_symbol (libc, ___pthread_timedjoin_np, pthread_timedjoin_np,
+                  GLIBC_2_34);
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_3_3, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_timedjoin_np, pthread_timedjoin_np,
+               GLIBC_2_3_3);
 #endif
-weak_alias (__pthread_timedjoin_np, pthread_timedjoin_np)
diff --git a/nptl/pthread_tryjoin.c b/nptl/pthread_tryjoin.c
index 62c9469258..fd938e8780 100644
--- a/nptl/pthread_tryjoin.c
+++ b/nptl/pthread_tryjoin.c
@@ -17,9 +17,10 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include "pthreadP.h"
+#include <shlib-compat.h>
 
 int
-pthread_tryjoin_np (pthread_t threadid, void **thread_return)
+__pthread_tryjoin_np (pthread_t threadid, void **thread_return)
 {
   /* Return right away if the thread hasn't terminated yet.  */
   struct pthread *pd = (struct pthread *) threadid;
@@ -31,3 +32,8 @@ pthread_tryjoin_np (pthread_t threadid, void **thread_return)
   return __pthread_clockjoin_ex (threadid, thread_return, 0 /* Ignored */,
 				 NULL, false);
 }
+versioned_symbol (libc, __pthread_tryjoin_np, pthread_tryjoin_np, GLIBC_2_34);
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_3_3, GLIBC_2_34)
+compat_symbol (libc, __pthread_tryjoin_np, pthread_tryjoin_np, GLIBC_2_3_3);
+#endif