From patchwork Mon Jul 7 04:48:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 115735 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE9773858C60 for ; Mon, 7 Jul 2025 04:48:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE9773858C60 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 32D533858D29 for ; Mon, 7 Jul 2025 04:48:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 32D533858D29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 32D533858D29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751863683; cv=none; b=ot7h4pDfKBaMIsS1v3Cotbr2PiIwM3BLZiu0eCD9fEzjMerOk+WkLuLZaETD7Oii4fG7iPMyU1EYvLjksmeRjAxbPDVg5O4HPzlZrGhQGetIwMNhRHKa/m8ICM7gbmY08t0PUIhjkmgGzVr+EJxYwk2Jc9I0cIaf4pEkjs8Nthg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751863683; c=relaxed/simple; bh=8yeh/Q+ARYrHPOXgrzgP04S5mG8luI3VcgWHUrG1nAM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Jp6nfxyxAIJ2Vbpf0lfnz85ywbGn6/iwe1qVqvyZIvR0Ew6NOj6wCxUt7faK/eNapTHC+Gwq5mzpP3YzX+T5lPrWxFUMoXUgd2hlWFVgZzOD4jnMj+F35J1ba0ckoMPkhCiUyjw/+ZVrsenXFlBSsLmf6Y+TCkgAbPKa4WcBTVM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32D533858D29 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 1130AA1CD6; Mon, 7 Jul 2025 06:48:02 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A2WgQb6vFrlo; Mon, 7 Jul 2025 06:48:01 +0200 (CEST) Received: from begin (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id C1673A03D7; Mon, 7 Jul 2025 06:48:01 +0200 (CEST) Received: from samy by begin with local (Exim 4.98.2) (envelope-from ) id 1uYdlp-00000009YvF-1O3p; Mon, 07 Jul 2025 06:48:01 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited] htl: move __pthread_get_cleanup_stack to libc Date: Mon, 7 Jul 2025 06:48:01 +0200 Message-ID: <20250707044801.2279186-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.47.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org This fixes the cleanup call from __qsort_r --- htl/Makefile | 2 +- htl/Versions | 3 +-- htl/forward.c | 3 --- htl/pt-cleanup.c | 10 ++++++++-- htl/pt-initialize.c | 1 - sysdeps/htl/include/bits/cancelation.h | 5 +++++ sysdeps/htl/libc-lock.h | 19 ++++--------------- sysdeps/htl/pthread-functions.h | 2 -- sysdeps/htl/pthreadP.h | 2 +- sysdeps/mach/hurd/Makefile | 3 ++- sysdeps/mach/hurd/i386/libc.abilist | 1 + sysdeps/mach/hurd/i386/libpthread.abilist | 1 - sysdeps/mach/hurd/x86_64/libpthread.abilist | 1 - 13 files changed, 23 insertions(+), 30 deletions(-) create mode 100644 sysdeps/htl/include/bits/cancelation.h diff --git a/htl/Makefile b/htl/Makefile index c4780479e3..82b7803c88 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -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 \ diff --git a/htl/Versions b/htl/Versions index 0052f82264..40ee2748a7 100644 --- a/htl/Versions +++ b/htl/Versions @@ -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; diff --git a/htl/forward.c b/htl/forward.c index 0a7a69644d..21acf664f4 100644 --- a/htl/forward.c +++ b/htl/forward.c @@ -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); diff --git a/htl/pt-cleanup.c b/htl/pt-cleanup.c index 863c38f5ae..76fdbe2918 100644 --- a/htl/pt-cleanup.c +++ b/htl/pt-cleanup.c @@ -19,10 +19,16 @@ #include #include +#include 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 diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c index 5ffee38bb3..b4e8b15b47 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_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 index 0000000000..ef2cd703de --- /dev/null +++ b/sysdeps/htl/include/bits/cancelation.h @@ -0,0 +1,5 @@ +#include_next + +#ifndef _ISOMAC +#include +#endif diff --git a/sysdeps/htl/libc-lock.h b/sysdeps/htl/libc-lock.h index 66779b9f6e..8e764a72f1 100644 --- a/sysdeps/htl/libc-lock.h +++ b/sysdeps/htl/libc-lock.h @@ -37,13 +37,10 @@ { \ __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) \ @@ -59,12 +56,4 @@ #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 diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h index 053649fe5d..aec13a6022 100644 --- a/sysdeps/htl/pthread-functions.h +++ b/sysdeps/htl/pthread-functions.h @@ -22,7 +22,6 @@ #include 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 *); diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 64db024cc8..535740f5ea 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -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) diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index f5ea3240c5..32bba616f1 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -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 diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index a0e686afc7..aac3cb3319 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -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 diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist index 51535ac1c4..9d2c4cd742 100644 --- a/sysdeps/mach/hurd/i386/libpthread.abilist +++ b/sysdeps/mach/hurd/i386/libpthread.abilist @@ -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 diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist index a1ff462ba9..81d355a94b 100644 --- a/sysdeps/mach/hurd/x86_64/libpthread.abilist +++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist @@ -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