[glibc] htl: move pthread_mutex_destroy into libc.

Samuel Thibault sthibaul@sourceware.org
Wed Jan 29 01:33:15 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8bfabe7a92322bde46f25671cc29d66111321d38

commit 8bfabe7a92322bde46f25671cc29d66111321d38
Author: gfleury <gfleury@disroot.org>
Date:   Fri Jan 3 12:37:48 2025 +0200

    htl: move pthread_mutex_destroy into libc.
    
    Message-ID: <20250103103750.870897-5-gfleury@disroot.org>

Diff:
---
 htl/Makefile                                | 2 +-
 htl/Versions                                | 4 ++--
 htl/forward.c                               | 2 --
 htl/pt-initialize.c                         | 1 -
 sysdeps/htl/libc-lockP.h                    | 2 --
 sysdeps/htl/pthread-functions.h             | 2 --
 sysdeps/htl/pthreadP.h                      | 2 --
 sysdeps/mach/hurd/htl/pt-mutex-destroy.c    | 8 ++++++--
 sysdeps/mach/hurd/i386/libc.abilist         | 1 +
 sysdeps/mach/hurd/i386/libpthread.abilist   | 1 -
 sysdeps/mach/hurd/x86_64/libpthread.abilist | 1 -
 11 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/htl/Makefile b/htl/Makefile
index f7e12983d2..f6abd95772 100644
--- a/htl/Makefile
+++ b/htl/Makefile
@@ -54,7 +54,6 @@ libpthread-routines := \
   pt-setcanceltype \
   pt-testcancel \
   pt-cancel \
-  pt-mutex-destroy \
   pt-mutex-transfer-np \
   pt-mutex-consistent \
   pt-rwlock-attr \
@@ -182,6 +181,7 @@ routines := \
   pt-condattr-setpshared \
   pt-getschedparam \
   pt-mutex-checklocked \
+  pt-mutex-destroy \
   pt-mutex-getprioceiling \
   pt-mutex-init \
   pt-mutex-lock \
diff --git a/htl/Versions b/htl/Versions
index 9c016bc6cf..9cd9f5a937 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -38,6 +38,7 @@ libc {
     pthread_condattr_getpshared;
     pthread_condattr_setclock;
     pthread_condattr_setpshared;
+    pthread_mutex_destroy;
     pthread_mutex_getprioceiling;
     pthread_mutex_init;
     pthread_mutex_lock;
@@ -151,6 +152,7 @@ libc {
     __pthread_condattr_init;
     __pthread_default_condattr;
     __pthread_mutex_checklocked;
+    __pthread_mutex_destroy;
     __pthread_mutex_init;
     __pthread_mutex_lock;
     __pthread_mutex_timedlock;
@@ -214,7 +216,6 @@ libpthread {
     pthread_kill;
     __pthread_kill;
 
-    pthread_mutex_destroy;
     pthread_mutex_transfer_np;
 
     pthread_once;
@@ -283,7 +284,6 @@ libpthread {
     __pthread_getspecific;
     __pthread_setspecific;
     __pthread_getattr_np;
-    __pthread_mutex_destroy;
     __pthread_enable_asynccancel;
     __pthread_disable_asynccancel;
     _pthread_rwlock_destroy; _pthread_rwlock_init;
diff --git a/htl/forward.c b/htl/forward.c
index b71099b82b..636902919e 100644
--- a/htl/forward.c
+++ b/htl/forward.c
@@ -58,8 +58,6 @@ FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval),
 		  exit (EXIT_SUCCESS))
 strong_alias (__pthread_exit, pthread_exit);
 
-FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0)
-
 FORWARD (__pthread_setcancelstate, (int state, int *oldstate),
 	 (state, oldstate), 0)
 strong_alias (__pthread_setcancelstate, pthread_setcancelstate);
diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c
index b8f8c95ce3..5854bc4967 100644
--- a/htl/pt-initialize.c
+++ b/htl/pt-initialize.c
@@ -28,7 +28,6 @@
 #if IS_IN (libpthread)
 static const struct pthread_functions pthread_functions = {
   .ptr___pthread_exit = __pthread_exit,
-  .ptr_pthread_mutex_destroy = __pthread_mutex_destroy,
   .ptr___pthread_setcancelstate = __pthread_setcancelstate,
   .ptr_pthread_setcanceltype = __pthread_setcanceltype,
   .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h
index 3d74cd87e9..f39c8bba87 100644
--- a/sysdeps/htl/libc-lockP.h
+++ b/sysdeps/htl/libc-lockP.h
@@ -117,7 +117,6 @@ extern int __pthread_atfork (void (*__prepare) (void),
    single-threaded processes.  */
 #if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
 # ifdef weak_extern
-weak_extern (__pthread_mutex_destroy)
 weak_extern (__pthread_rwlock_init)
 weak_extern (__pthread_rwlock_destroy)
 weak_extern (__pthread_rwlock_rdlock)
@@ -133,7 +132,6 @@ weak_extern (__pthread_initialize)
 weak_extern (__pthread_atfork)
 weak_extern (__pthread_setcancelstate)
 # else
-#  pragma weak __pthread_mutex_destroy
 #  pragma weak __pthread_rwlock_destroy
 #  pragma weak __pthread_rwlock_rdlock
 #  pragma weak __pthread_rwlock_tryrdlock
diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h
index c44c9038f3..45f15c2641 100644
--- a/sysdeps/htl/pthread-functions.h
+++ b/sysdeps/htl/pthread-functions.h
@@ -22,7 +22,6 @@
 #include <pthread.h>
 
 void __pthread_exit (void *) __attribute__ ((__noreturn__));
-int _pthread_mutex_destroy (pthread_mutex_t *);
 int __pthread_setcancelstate (int, int *);
 int __pthread_setcanceltype (int, int *);
 struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
@@ -44,7 +43,6 @@ int _cthreads_ftrylockfile (FILE *);
 struct pthread_functions
 {
   void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
-  int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *);
   int (*ptr___pthread_setcancelstate) (int, int *);
   int (*ptr_pthread_setcanceltype) (int, int *);
   struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index e41cb4c85d..f8aab6af9e 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -36,7 +36,6 @@ libc_hidden_proto (__pthread_mutex_init)
 extern int __pthread_mutex_clocklock (pthread_mutex_t *__mutex, clockid_t __clockid,
 				    const struct timespec *__abstime);
 libc_hidden_proto (__pthread_mutex_clocklock)
-extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
 extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
 libc_hidden_proto (__pthread_mutex_lock)
 extern int __pthread_mutex_getprioceiling (const pthread_mutex_t *__mutex,
@@ -176,7 +175,6 @@ hidden_proto (__pthread_detach)
 hidden_proto (__pthread_key_create)
 hidden_proto (__pthread_getspecific)
 hidden_proto (__pthread_setspecific)
-hidden_proto (__pthread_mutex_destroy)
 hidden_proto (__pthread_get_cleanup_stack)
 #endif
 
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
index fdb59623bb..c0624ec72f 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
@@ -22,6 +22,7 @@
 #include <pt-internal.h>
 #include "pt-mutex.h"
 #include <hurdlock.h>
+#include <shlib-compat.h>
 
 int
 __pthread_mutex_destroy (pthread_mutex_t *mtxp)
@@ -33,6 +34,9 @@ __pthread_mutex_destroy (pthread_mutex_t *mtxp)
   mtxp->__type = -1;
   return 0;
 }
+libc_hidden_def (__pthread_mutex_destroy)
+versioned_symbol (libc, __pthread_mutex_destroy, pthread_mutex_destroy, GLIBC_2_21);
 
-weak_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
-hidden_def (__pthread_mutex_destroy)
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21)
+compat_symbol (libc, __pthread_mutex_destroy, pthread_mutex_destroy, GLIBC_2_12);
+#endif
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index c980b46bca..f153f475c3 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -63,6 +63,7 @@ GLIBC_2.12 pthread_condattr_setclock F
 GLIBC_2.12 pthread_condattr_setpshared F
 GLIBC_2.12 pthread_equal F
 GLIBC_2.12 pthread_getschedparam F
+GLIBC_2.12 pthread_mutex_destroy F
 GLIBC_2.12 pthread_mutex_getprioceiling F
 GLIBC_2.12 pthread_mutex_init F
 GLIBC_2.12 pthread_mutex_lock F
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index 0eb452eb02..53b433c725 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -41,7 +41,6 @@ GLIBC_2.12 pthread_join F
 GLIBC_2.12 pthread_key_create F
 GLIBC_2.12 pthread_key_delete F
 GLIBC_2.12 pthread_kill F
-GLIBC_2.12 pthread_mutex_destroy F
 GLIBC_2.12 pthread_mutex_transfer_np F
 GLIBC_2.12 pthread_once F
 GLIBC_2.12 pthread_rwlock_destroy F
diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist
index faeac21d94..5f0f73d10f 100644
--- a/sysdeps/mach/hurd/x86_64/libpthread.abilist
+++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist
@@ -63,7 +63,6 @@ GLIBC_2.38 pthread_key_delete F
 GLIBC_2.38 pthread_kill F
 GLIBC_2.38 pthread_mutex_consistent F
 GLIBC_2.38 pthread_mutex_consistent_np F
-GLIBC_2.38 pthread_mutex_destroy F
 GLIBC_2.38 pthread_mutex_transfer_np F
 GLIBC_2.38 pthread_once F
 GLIBC_2.38 pthread_rwlock_clockrdlock F


More information about the Glibc-cvs mailing list