1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-10 05:03:06 +03:00

htl: move __pthread_get_cleanup_stack to libc

This fixes the cleanup call from __qsort_r
This commit is contained in:
Samuel Thibault
2025-07-06 11:01:19 +02:00
parent b80f108b55
commit 6afece738c
13 changed files with 23 additions and 30 deletions

View File

@@ -35,7 +35,6 @@ libpthread-routines := \
pt-initialize \ pt-initialize \
pt-join \ pt-join \
pt-spin-inlines \ pt-spin-inlines \
pt-cleanup \
pt-testcancel \ pt-testcancel \
pt-cancel \ pt-cancel \
pt-mutex-transfer-np \ pt-mutex-transfer-np \
@@ -143,6 +142,7 @@ routines := \
pt-barrierattr-setpshared \ pt-barrierattr-setpshared \
pt-block \ pt-block \
pt-block-intr \ pt-block-intr \
pt-cleanup \
pt-cond \ pt-cond \
pt-cond-brdcast \ pt-cond-brdcast \
pt-cond-destroy \ pt-cond-destroy \

View File

@@ -2,6 +2,7 @@ libc {
GLIBC_2.12 { GLIBC_2.12 {
pthread_self; pthread_self;
__pthread_get_cleanup_stack;
__pthread_key_create; __pthread_key_create;
__pthread_self; __pthread_self;
pthread_attr_getdetachstate; pthread_attr_getdetachstate;
@@ -242,8 +243,6 @@ libpthread {
__errno_location; __h_errno_location; __errno_location; __h_errno_location;
} }
GLIBC_2.12 { GLIBC_2.12 {
__pthread_get_cleanup_stack;
__pthread_mutex_transfer_np; __pthread_mutex_transfer_np;
cthread_detach; cthread_detach;

View File

@@ -57,6 +57,3 @@ name decl \
FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval), FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval),
exit (EXIT_SUCCESS)) exit (EXIT_SUCCESS))
strong_alias (__pthread_exit, pthread_exit); strong_alias (__pthread_exit, pthread_exit);
FORWARD2 (__pthread_get_cleanup_stack, struct __pthread_cancelation_handler **,
(void), (), return &__pthread_cleanup_stack);

View File

@@ -19,10 +19,16 @@
#include <pthread.h> #include <pthread.h>
#include <pt-internal.h> #include <pt-internal.h>
#include <shlib-compat.h>
struct __pthread_cancelation_handler ** struct __pthread_cancelation_handler **
__pthread_get_cleanup_stack (void) ___pthread_get_cleanup_stack (void)
{ {
return &__pthread_cleanup_stack; 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

View File

@@ -28,7 +28,6 @@
#if IS_IN (libpthread) #if IS_IN (libpthread)
static const struct pthread_functions pthread_functions = { static const struct pthread_functions pthread_functions = {
.ptr___pthread_exit = __pthread_exit, .ptr___pthread_exit = __pthread_exit,
.ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
.ptr__IO_flockfile = _cthreads_flockfile, .ptr__IO_flockfile = _cthreads_flockfile,
.ptr__IO_funlockfile = _cthreads_funlockfile, .ptr__IO_funlockfile = _cthreads_funlockfile,
.ptr__IO_ftrylockfile = _cthreads_ftrylockfile, .ptr__IO_ftrylockfile = _cthreads_ftrylockfile,

View File

@@ -0,0 +1,5 @@
#include_next <bits/cancelation.h>
#ifndef _ISOMAC
#include <pthreadP.h>
#endif

View File

@@ -37,14 +37,11 @@
{ \ { \
__handler.__handler = FCT; \ __handler.__handler = FCT; \
__handler.__arg = ARG; \ __handler.__arg = ARG; \
if (__pthread_get_cleanup_stack != NULL) \
{ \
__handlers = __pthread_get_cleanup_stack (); \ __handlers = __pthread_get_cleanup_stack (); \
__handler.__next = *__handlers; \ __handler.__next = *__handlers; \
*__handlers = &__handler; \ *__handlers = &__handler; \
__registered = 1; \ __registered = 1; \
} \ } \
} \
#define __libc_cleanup_end(DOIT) \ #define __libc_cleanup_end(DOIT) \
if (__registered) \ if (__registered) \
@@ -59,12 +56,4 @@
#define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg) #define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
#define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute) #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 #endif

View File

@@ -22,7 +22,6 @@
#include <pthread.h> #include <pthread.h>
void __pthread_exit (void *) __attribute__ ((__noreturn__)); void __pthread_exit (void *) __attribute__ ((__noreturn__));
struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
void _cthreads_flockfile (FILE *); void _cthreads_flockfile (FILE *);
void _cthreads_funlockfile (FILE *); void _cthreads_funlockfile (FILE *);
@@ -34,7 +33,6 @@ int _cthreads_ftrylockfile (FILE *);
struct pthread_functions struct pthread_functions
{ {
void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__)); 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_flockfile) (FILE *);
void (*ptr__IO_funlockfile) (FILE *); void (*ptr__IO_funlockfile) (FILE *);
int (*ptr__IO_ftrylockfile) (FILE *); int (*ptr__IO_ftrylockfile) (FILE *);

View File

@@ -216,11 +216,11 @@ int __pthread_condattr_init (pthread_condattr_t *attr);
libc_hidden_proto (__pthread_self) libc_hidden_proto (__pthread_self)
libc_hidden_proto (__pthread_attr_init) libc_hidden_proto (__pthread_attr_init)
libc_hidden_proto (__pthread_condattr_init) libc_hidden_proto (__pthread_condattr_init)
libc_hidden_proto (__pthread_get_cleanup_stack)
#if IS_IN (libpthread) #if IS_IN (libpthread)
hidden_proto (__pthread_create) hidden_proto (__pthread_create)
hidden_proto (__pthread_detach) hidden_proto (__pthread_detach)
hidden_proto (__pthread_get_cleanup_stack)
#endif #endif
#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread) #if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)

View File

@@ -337,7 +337,8 @@ ifeq ($(subdir),stdlib)
tests-unsupported += test-bz22786 tst-strtod-overflow tests-unsupported += test-bz22786 tst-strtod-overflow
# pthread_cleanup_combined_push/pthread_cleanup_combined_pop requires cleanup # pthread_cleanup_combined_push/pthread_cleanup_combined_pop requires cleanup
# support (BZ 32058). # support (BZ 32058).
test-xfail-tst-qsortx7 = yes test-xfail-tst-qsort7-mem = yes
test-xfail-tst-qsortx7-mem = yes
endif endif
ifeq ($(subdir),timezone) ifeq ($(subdir),timezone)
tests-unsupported += tst-tzset tests-unsupported += tst-tzset

View File

@@ -28,6 +28,7 @@ GLIBC_2.11 mkostemps F
GLIBC_2.11 mkostemps64 F GLIBC_2.11 mkostemps64 F
GLIBC_2.11 mkstemps F GLIBC_2.11 mkstemps F
GLIBC_2.11 mkstemps64 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_key_create F
GLIBC_2.12 __pthread_self F GLIBC_2.12 __pthread_self F
GLIBC_2.12 pthread_attr_destroy F GLIBC_2.12 pthread_attr_destroy F

View File

@@ -1,6 +1,5 @@
GLIBC_2.12 __mutex_lock_solid F GLIBC_2.12 __mutex_lock_solid F
GLIBC_2.12 __mutex_unlock_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_kill F
GLIBC_2.12 __pthread_mutex_transfer_np F GLIBC_2.12 __pthread_mutex_transfer_np F
GLIBC_2.12 __pthread_spin_destroy F GLIBC_2.12 __pthread_spin_destroy F

View File

@@ -5,7 +5,6 @@ GLIBC_2.38 __errno_location F
GLIBC_2.38 __h_errno_location F GLIBC_2.38 __h_errno_location F
GLIBC_2.38 __mutex_lock_solid F GLIBC_2.38 __mutex_lock_solid F
GLIBC_2.38 __mutex_unlock_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_kill F
GLIBC_2.38 __pthread_mutex_transfer_np F GLIBC_2.38 __pthread_mutex_transfer_np F
GLIBC_2.38 __pthread_spin_destroy F GLIBC_2.38 __pthread_spin_destroy F