]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: move __pthread_get_cleanup_stack to libc master
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 6 Jul 2025 09:01:19 +0000 (11:01 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 6 Jul 2025 19:56:15 +0000 (19:56 +0000)
This fixes the cleanup call from __qsort_r

13 files changed:
htl/Makefile
htl/Versions
htl/forward.c
htl/pt-cleanup.c
htl/pt-initialize.c
sysdeps/htl/include/bits/cancelation.h [new file with mode: 0644]
sysdeps/htl/libc-lock.h
sysdeps/htl/pthread-functions.h
sysdeps/htl/pthreadP.h
sysdeps/mach/hurd/Makefile
sysdeps/mach/hurd/i386/libc.abilist
sysdeps/mach/hurd/i386/libpthread.abilist
sysdeps/mach/hurd/x86_64/libpthread.abilist

index c4780479e35989432085dd1acf26151c533f9704..82b7803c88c9e258daa7a8d51f931f034332feac 100644 (file)
@@ -35,7 +35,6 @@ libpthread-routines := \
   pt-initialize \
   pt-join \
   pt-spin-inlines \
-  pt-cleanup \
   pt-testcancel \
   pt-cancel \
   pt-mutex-transfer-np \
@@ -143,6 +142,7 @@ routines := \
   pt-barrierattr-setpshared \
   pt-block \
   pt-block-intr \
+  pt-cleanup \
   pt-cond \
   pt-cond-brdcast \
   pt-cond-destroy \
index 0052f82264d5f7b352279f641323f985aa0dad67..40ee2748a795f617a6e882011b44541020e19531 100644 (file)
@@ -2,6 +2,7 @@ libc {
 
   GLIBC_2.12 {
     pthread_self;
+    __pthread_get_cleanup_stack;
     __pthread_key_create;
     __pthread_self;
     pthread_attr_getdetachstate;
@@ -242,8 +243,6 @@ libpthread {
     __errno_location; __h_errno_location;
   }
   GLIBC_2.12 {
-    __pthread_get_cleanup_stack;
-
     __pthread_mutex_transfer_np;
 
     cthread_detach;
index 0a7a69644d8db33c0338d60e671a5e101a7cb5a2..21acf664f449c1a6fcefc46bdefc34387ba8796c 100644 (file)
@@ -57,6 +57,3 @@ name decl                                                                   \
 FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval),
                  exit (EXIT_SUCCESS))
 strong_alias (__pthread_exit, pthread_exit);
-
-FORWARD2 (__pthread_get_cleanup_stack, struct __pthread_cancelation_handler **,
-         (void), (), return &__pthread_cleanup_stack);
index 863c38f5ae102c4106e9f6acf77b4447f4e5fc6e..76fdbe291803e93d9fbc452c8981776083df8449 100644 (file)
 #include <pthread.h>
 
 #include <pt-internal.h>
+#include <shlib-compat.h>
 
 struct __pthread_cancelation_handler **
-__pthread_get_cleanup_stack (void)
+___pthread_get_cleanup_stack (void)
 {
   return &__pthread_cleanup_stack;
 }
-hidden_def(__pthread_get_cleanup_stack)
+versioned_symbol (libc, ___pthread_get_cleanup_stack, __pthread_get_cleanup_stack, GLIBC_2_21);
+libc_hidden_ver (___pthread_get_cleanup_stack, __pthread_get_cleanup_stack)
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21)
+compat_symbol (libpthread, ___pthread_get_cleanup_stack, __pthread_get_cleanup_stack, GLIBC_2_12);
+#endif
index 5ffee38bb3ce9d59c57a1180be482f1f32f71e4b..b4e8b15b475a331e9d1f9f3e95fb609a472a74f0 100644 (file)
@@ -28,7 +28,6 @@
 #if IS_IN (libpthread)
 static const struct pthread_functions pthread_functions = {
   .ptr___pthread_exit = __pthread_exit,
-  .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
   .ptr__IO_flockfile = _cthreads_flockfile,
   .ptr__IO_funlockfile = _cthreads_funlockfile,
   .ptr__IO_ftrylockfile = _cthreads_ftrylockfile,
diff --git a/sysdeps/htl/include/bits/cancelation.h b/sysdeps/htl/include/bits/cancelation.h
new file mode 100644 (file)
index 0000000..ef2cd70
--- /dev/null
@@ -0,0 +1,5 @@
+#include_next <bits/cancelation.h>
+
+#ifndef _ISOMAC
+#include <pthreadP.h>
+#endif
index 66779b9f6eb9d108d9f4a62701024fcc212308e3..8e764a72f1862d507ed83b388530a0b365799251 100644 (file)
       {                                                                              \
        __handler.__handler = FCT;                                            \
        __handler.__arg = ARG;                                                \
-       if (__pthread_get_cleanup_stack != NULL)                              \
-         {                                                                   \
-           __handlers = __pthread_get_cleanup_stack ();                      \
-           __handler.__next = *__handlers;                                   \
-           *__handlers = &__handler;                                         \
-           __registered = 1;                                                 \
-         }                                                                   \
+       __handlers = __pthread_get_cleanup_stack ();                          \
+       __handler.__next = *__handlers;                                       \
+       *__handlers = &__handler;                                             \
+       __registered = 1;                                                     \
       }                                                                              \
 
 #define __libc_cleanup_end(DOIT) \
 #define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
 #define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute)
 
-#if !IS_IN (libpthread)
-# ifdef weak_extern
-weak_extern (__pthread_get_cleanup_stack)
-# else
-#  pragma weak __pthread_get_cleanup_stack
-# endif
-#endif
-
 #endif
index 053649fe5d52e3e762ef6babf0fc4959ca76d9a7..aec13a6022f08a4f7a502fc00a292b12135acd5d 100644 (file)
@@ -22,7 +22,6 @@
 #include <pthread.h>
 
 void __pthread_exit (void *) __attribute__ ((__noreturn__));
-struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
 
 void _cthreads_flockfile (FILE *);
 void _cthreads_funlockfile (FILE *);
@@ -34,7 +33,6 @@ int _cthreads_ftrylockfile (FILE *);
 struct pthread_functions
 {
   void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
-  struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
   void (*ptr__IO_flockfile) (FILE *);
   void (*ptr__IO_funlockfile) (FILE *);
   int (*ptr__IO_ftrylockfile) (FILE *);
index 64db024cc893a9cf09ac8c8d954795dc34e504a6..535740f5ea399d2a6cd83b3ef50464d2e04c89d7 100644 (file)
@@ -216,11 +216,11 @@ int __pthread_condattr_init (pthread_condattr_t *attr);
 libc_hidden_proto (__pthread_self)
 libc_hidden_proto (__pthread_attr_init)
 libc_hidden_proto (__pthread_condattr_init)
+libc_hidden_proto (__pthread_get_cleanup_stack)
 
 #if IS_IN (libpthread)
 hidden_proto (__pthread_create)
 hidden_proto (__pthread_detach)
-hidden_proto (__pthread_get_cleanup_stack)
 #endif
 
 #if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
index f5ea3240c55d59089fb47fc7541b731a398fb042..32bba616f1ca34840dff438515ccc2d93beaa001 100644 (file)
@@ -337,7 +337,8 @@ ifeq ($(subdir),stdlib)
 tests-unsupported += test-bz22786 tst-strtod-overflow
 # pthread_cleanup_combined_push/pthread_cleanup_combined_pop requires cleanup
 # support (BZ 32058).
-test-xfail-tst-qsortx7 = yes
+test-xfail-tst-qsort7-mem = yes
+test-xfail-tst-qsortx7-mem = yes
 endif
 ifeq ($(subdir),timezone)
 tests-unsupported += tst-tzset
index a0e686afc7a4709c179a9ebf053c3958d936e05f..aac3cb3319dd4b7873a8733af9c87590ac5ecfa5 100644 (file)
@@ -28,6 +28,7 @@ GLIBC_2.11 mkostemps F
 GLIBC_2.11 mkostemps64 F
 GLIBC_2.11 mkstemps F
 GLIBC_2.11 mkstemps64 F
+GLIBC_2.12 __pthread_get_cleanup_stack F
 GLIBC_2.12 __pthread_key_create F
 GLIBC_2.12 __pthread_self F
 GLIBC_2.12 pthread_attr_destroy F
index 51535ac1c458819be7a99ee5a7b6dbea8b1eb4dc..9d2c4cd7428a274aec5730743b44915f1c3cae6a 100644 (file)
@@ -1,6 +1,5 @@
 GLIBC_2.12 __mutex_lock_solid F
 GLIBC_2.12 __mutex_unlock_solid F
-GLIBC_2.12 __pthread_get_cleanup_stack F
 GLIBC_2.12 __pthread_kill F
 GLIBC_2.12 __pthread_mutex_transfer_np F
 GLIBC_2.12 __pthread_spin_destroy F
index a1ff462ba98973ee63253acbe687b03426460615..81d355a94b3345b6b0b4e07c2bbe79bf6372b6ad 100644 (file)
@@ -5,7 +5,6 @@ GLIBC_2.38 __errno_location F
 GLIBC_2.38 __h_errno_location F
 GLIBC_2.38 __mutex_lock_solid F
 GLIBC_2.38 __mutex_unlock_solid F
-GLIBC_2.38 __pthread_get_cleanup_stack F
 GLIBC_2.38 __pthread_kill F
 GLIBC_2.38 __pthread_mutex_transfer_np F
 GLIBC_2.38 __pthread_spin_destroy F