about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-02-10 11:35:05 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-02-20 08:57:01 +0100
commitdc6cfdc934db9997c33728082d63552b9eee4563 (patch)
treef2b9641c24288f1d167a8062e35e726d5aefaf4e /nptl
parent7da5c345a5f527dc6213e8540e4a9c6eceeb6774 (diff)
downloadglibc-dc6cfdc934db9997c33728082d63552b9eee4563.tar.gz
glibc-dc6cfdc934db9997c33728082d63552b9eee4563.tar.xz
glibc-dc6cfdc934db9997c33728082d63552b9eee4563.zip
nptl: Move pthread_cond_destroy implementation into libc
It is necessary to export __pthread_cond_destroy from libc because
the C11 condition variable needs it and is still left in libpthread.

This is part of the libpthread removal project:

  <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html>

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile6
-rw-r--r--nptl/Versions6
-rw-r--r--nptl/forward.c10
-rw-r--r--nptl/nptl-init.c2
-rw-r--r--nptl/old_pthread_cond_destroy.c4
-rw-r--r--nptl/pthreadP.h1
-rw-r--r--nptl/pthread_cond_destroy.c3
7 files changed, 13 insertions, 19 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index c5e2349ab7..e6d127ea4f 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -36,6 +36,7 @@ routines = \
   libc-lowlevellock \
   libc_multiple_threads \
   libc_pthread_init \
+  old_pthread_cond_destroy \
   pthread_atfork \
   pthread_attr_destroy \
   pthread_attr_getdetachstate \
@@ -49,6 +50,7 @@ routines = \
   pthread_attr_setschedparam \
   pthread_attr_setschedpolicy \
   pthread_attr_setscope \
+  pthread_cond_destroy \
   pthread_condattr_destroy \
   pthread_condattr_init \
   pthread_equal \
@@ -102,10 +104,10 @@ libpthread-routines = nptl-init nptlfreeres vars events version pt-interp \
 		      pthread_rwlockattr_setpshared \
 		      pthread_rwlockattr_getkind_np \
 		      pthread_rwlockattr_setkind_np \
-		      pthread_cond_init pthread_cond_destroy \
+		      pthread_cond_init \
 		      pthread_cond_wait \
 		      pthread_cond_signal pthread_cond_broadcast \
-		      old_pthread_cond_init old_pthread_cond_destroy \
+		      old_pthread_cond_init \
 		      old_pthread_cond_wait old_pthread_cond_timedwait \
 		      old_pthread_cond_signal old_pthread_cond_broadcast \
 		      pthread_condattr_getpshared pthread_condattr_setpshared \
diff --git a/nptl/Versions b/nptl/Versions
index bc1bad0562..4dbe68d76c 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -39,6 +39,8 @@ libc {
     __libc_pthread_init;
     __libc_current_sigrtmin_private; __libc_current_sigrtmax_private;
     __libc_allocate_rtsig_private;
+    # Used by the C11 threads implementation.
+    __pthread_cond_destroy;
   }
 }
 
@@ -54,7 +56,7 @@ libpthread {
 
     pthread_mutexattr_init; pthread_mutexattr_destroy;
 
-    pthread_cond_init; pthread_cond_destroy;
+    pthread_cond_init;
     pthread_cond_wait; pthread_cond_timedwait;
     pthread_cond_signal; pthread_cond_broadcast;
 
@@ -193,7 +195,7 @@ libpthread {
 
   GLIBC_2.3.2 {
     # Changed pthread_cond_t.
-    pthread_cond_init; pthread_cond_destroy;
+    pthread_cond_init;
     pthread_cond_wait; pthread_cond_timedwait;
     pthread_cond_signal; pthread_cond_broadcast;
   }
diff --git a/nptl/forward.c b/nptl/forward.c
index 9383ada753..3e1734854e 100644
--- a/nptl/forward.c
+++ b/nptl/forward.c
@@ -67,16 +67,6 @@ versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast,
 		  GLIBC_2_3_2);
 
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
-FORWARD2 (__pthread_cond_destroy_2_0, int attribute_compat_text_section,
-	  (pthread_cond_2_0_t *cond), (cond), return 0)
-compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy,
-	       GLIBC_2_0);
-#endif
-FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0)
-versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy,
-		  GLIBC_2_3_2);
-
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
 FORWARD2 (__pthread_cond_init_2_0, int attribute_compat_text_section,
 	  (pthread_cond_2_0_t *cond, const pthread_condattr_t *cond_attr),
 	  (cond, cond_attr), return 0)
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 6e681bafd1..068eb3dfb6 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -73,14 +73,12 @@ void __nptl_set_robust (struct pthread *);
 static const struct pthread_functions pthread_functions =
   {
     .ptr___pthread_cond_broadcast = __pthread_cond_broadcast,
-    .ptr___pthread_cond_destroy = __pthread_cond_destroy,
     .ptr___pthread_cond_init = __pthread_cond_init,
     .ptr___pthread_cond_signal = __pthread_cond_signal,
     .ptr___pthread_cond_wait = __pthread_cond_wait,
     .ptr___pthread_cond_timedwait = __pthread_cond_timedwait,
 # if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
     .ptr___pthread_cond_broadcast_2_0 = __pthread_cond_broadcast_2_0,
-    .ptr___pthread_cond_destroy_2_0 = __pthread_cond_destroy_2_0,
     .ptr___pthread_cond_init_2_0 = __pthread_cond_init_2_0,
     .ptr___pthread_cond_signal_2_0 = __pthread_cond_signal_2_0,
     .ptr___pthread_cond_wait_2_0 = __pthread_cond_wait_2_0,
diff --git a/nptl/old_pthread_cond_destroy.c b/nptl/old_pthread_cond_destroy.c
index 46dad05d49..4996deceb8 100644
--- a/nptl/old_pthread_cond_destroy.c
+++ b/nptl/old_pthread_cond_destroy.c
@@ -21,7 +21,7 @@
 #include <shlib-compat.h>
 
 
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
 int
 __pthread_cond_destroy_2_0 (pthread_cond_2_0_t *cond)
 {
@@ -30,6 +30,6 @@ __pthread_cond_destroy_2_0 (pthread_cond_2_0_t *cond)
 
   return 0;
 }
-compat_symbol (libpthread, __pthread_cond_destroy_2_0, pthread_cond_destroy,
+compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy,
 	       GLIBC_2_0);
 #endif
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index df4b1a0cda..fd31fbc87f 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -444,6 +444,7 @@ extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
 extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
 extern int __pthread_cond_broadcast (pthread_cond_t *cond);
 extern int __pthread_cond_destroy (pthread_cond_t *cond);
+libc_hidden_proto (__pthread_cond_destroy)
 extern int __pthread_cond_init (pthread_cond_t *cond,
 				const pthread_condattr_t *cond_attr);
 extern int __pthread_cond_signal (pthread_cond_t *cond);
diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c
index 168546574b..31034905d1 100644
--- a/nptl/pthread_cond_destroy.c
+++ b/nptl/pthread_cond_destroy.c
@@ -58,5 +58,6 @@ __pthread_cond_destroy (pthread_cond_t *cond)
   /* The memory the condvar occupies can now be reused.  */
   return 0;
 }
-versioned_symbol (libpthread, __pthread_cond_destroy,
+libc_hidden_def (__pthread_cond_destroy)
+versioned_symbol (libc, __pthread_cond_destroy,
 		  pthread_cond_destroy, GLIBC_2_3_2);