From patchwork Tue Mar 2 10:37:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 42195 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 A1CEF3861012; Tue, 2 Mar 2021 10:37:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1CEF3861012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1614681475; bh=u5yRS6t+l0Ee775ifgcD0gn2wRnr+BAZTZNzQkm8fyc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SRC2yO+i6OJVJUr7cxkrwJwIup/zaYJ4mfUn0Sj6rJuWNOPp/yMwTR6aA6mQM392k GIR4cKssPBNWSaQDGEPckDoC0Xy1b1YJ9rfH7bIqQi0pYTB+q+JxGU1PPf15exKbzL BntuA+VBUj6r38MFjr2gbRjuQHZICXTB2o9+qk0o= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 543FF3857812 for ; Tue, 2 Mar 2021 10:37:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 543FF3857812 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-4-t65GGC24Nxa-ekW_wMWpdg-1; Tue, 02 Mar 2021 05:37:50 -0500 X-MC-Unique: t65GGC24Nxa-ekW_wMWpdg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08810801977 for ; Tue, 2 Mar 2021 10:37:50 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-51.ams2.redhat.com [10.36.112.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60BDB61D31 for ; Tue, 2 Mar 2021 10:37:49 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] nptl: __libc_cleanup_push/__libc_cleanup_pop require -fexceptions Date: Tue, 02 Mar 2021 11:37:52 +0100 Message-ID: <87im69264f.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Do not define these macros if they do nothing in a particular compilation, otherwise they can easily be used accidentally, while not actually achieving anything. Built with build-many-glibcs.py after the __dl_iterate_phdr fix. --- sysdeps/nptl/libc-lockP.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h index e676eadfd3..7cdf17005f 100644 --- a/sysdeps/nptl/libc-lockP.h +++ b/sysdeps/nptl/libc-lockP.h @@ -271,6 +271,9 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer } else if (DOIT) \ _buffer.__routine (_buffer.__arg) +/* __libc_cleanup_push and __libc_cleanup_pop depend on exception + handling and stack unwinding. */ +#ifdef __EXCEPTIONS /* Normal cleanup handling, based on C cleanup attribute. */ static __always_inline void @@ -280,17 +283,17 @@ __libc_cleanup_routine (struct __pthread_cleanup_frame *f) f->__cancel_routine (f->__cancel_arg); } -#define __libc_cleanup_push(fct, arg) \ +# define __libc_cleanup_push(fct, arg) \ do { \ struct __pthread_cleanup_frame __clframe \ __attribute__ ((__cleanup__ (__libc_cleanup_routine))) \ = { .__cancel_routine = (fct), .__cancel_arg = (arg), \ .__do_it = 1 }; -#define __libc_cleanup_pop(execute) \ +# define __libc_cleanup_pop(execute) \ __clframe.__do_it = (execute); \ } while (0) - +#endif /* __EXCEPTIONS */ /* Create thread-specific key. */ #define __libc_key_create(KEY, DESTRUCTOR) \