From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp001-out.apm-internet.net (smtp001-out.apm-internet.net [85.119.248.222]) by sourceware.org (Postfix) with ESMTPS id 658EE3858C83 for ; Sun, 25 Sep 2022 06:29:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 658EE3858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=sandoe.co.uk Received: (qmail 48786 invoked from network); 25 Sep 2022 06:29:13 -0000 X-APM-Out-ID: 16640873524878 X-APM-Authkey: 257869/1(257869/1) 2 Received: from unknown (HELO ?192.168.1.95?) (81.138.1.83) by smtp001.apm-internet.net with SMTP; 25 Sep 2022 06:29:13 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: [PATCH] Avoid depending on destructor order From: Iain Sandoe In-Reply-To: Date: Sun, 25 Sep 2022 07:29:12 +0100 Cc: GCC Patches Content-Transfer-Encoding: quoted-printable Message-Id: References: <88e489d8-4248-75de-6e8e-af6f152da61b@in.tum.de> To: Thomas Neumann X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_COUK,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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 List-Id: > On 23 Sep 2022, at 15:30, David Edelsohn via Gcc-patches = wrote: >=20 > On Fri, Sep 23, 2022 at 10:12 AM Thomas Neumann = wrote: >=20 >>>=20 >>> +static const bool in_shutdown =3D false; >>>=20 >>> I'll let Jason or others decide if this is the right solution. It = seems >>> that in_shutdown also could be declared outside the #ifdef and >>> initialized as "false". >>=20 >> sure, either is fine. Moving it outside the #ifdef wastes one byte in >> the executable (while the compiler can eliminate the const), but it = does >> not really matter. >>=20 >> I have verified that the patch below fixes builds for both fast-path = and >> non-fast-path builds. But if you prefer I will move the in_shutdown >> definition instead. >>=20 >> Best >>=20 >> Thomas >>=20 >> PS: in_shutdown is an int here instead of a bool because = non-fast-path >> builds do not include stdbool. Not a good reason, of course, but I >> wanted to keep the patch minimal and it makes no difference in = practice. >>=20 >>=20 >> When using the atomic fast path deregistering can fail during >> program shutdown if the lookup structures are already destroyed. >> The assert in __deregister_frame_info_bases takes that into >> account. In the non-fast-path case however is not aware of >> program shutdown, which caused a compiler error on such = platforms. >> We fix that by introducing a constant for in_shutdown in >> non-fast-path builds. >>=20 >> libgcc/ChangeLog: >> * unwind-dw2-fde.c: Introduce a constant for in_shutdown >> for the non-fast-path case. >>=20 >> diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c >> index d237179f4ea..0bcd5061d76 100644 >> --- a/libgcc/unwind-dw2-fde.c >> +++ b/libgcc/unwind-dw2-fde.c >> @@ -67,6 +67,8 @@ static void >> init_object (struct object *ob); >>=20 >> #else >> +/* Without fast path frame deregistration must always succeed. */ >> +static const int in_shutdown =3D 0; >>=20 >> /* The unseen_objects list contains objects that have been = registered >> but not yet categorized in any way. The seen_objects list has = had >>=20 >=20 > Thanks for the patch. I'll let you and Jason decide which style = solution > is preferred. This also breaks bootstrap on Darwin at least, so an early solution = would be welcome (the fix here allows bootstrap to continue, testing on-going). thanks, Iain >=20 > Thanks, David