From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.rbg.tum.de (mailout2.rbg.tum.de [131.159.0.202]) by sourceware.org (Postfix) with ESMTPS id 682703857824 for ; Fri, 23 Sep 2022 14:12:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 682703857824 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=in.tum.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=in.tum.de Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout2.rbg.tum.de (Postfix) with ESMTPS id 3B74E4C0200; Fri, 23 Sep 2022 16:12:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.tum.de; s=20220209; t=1663942336; bh=/4o1IqaYycVPpy9adO1839XbLgEqW7uZoaBHuty7p1o=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZCwHD8keH63lyYDBzFjMmxCuEWby3OvAO1SUNu0JDogoxPYmceBrSF055MAdAgD6h JFkwc0eqynwUnba5MKb4YeXKOtaAkAJ3SkwP7ALDIVbpkBy8Yh6DONSsE00G7rJvmn 5D2Nh7JRtNfPiH5F9BAGFNF5gqdx57WF0iawk1xz7TohTD2KB10b9HiuiYsLCfTpr+ SMxwciVl2w82DQpkZGeVKJp/nqlOaZ41VLI+ElcVJlxKTPitiemLrrBxRarKQVxNbp nBwQbQdK3RhQUBU40xo4qIKvXLzmYsbLnUV4le6BCCwXJRzQqGewVcVNk3X8JugtcB x9S6XVP4DpgDA== Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 367BD1A8; Fri, 23 Sep 2022 16:12:16 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 160741A1; Fri, 23 Sep 2022 16:12:16 +0200 (CEST) Received: from mail.in.tum.de (mailproxy.in.tum.de [IPv6:2a09:80c0::78]) by mailrelay1.rbg.tum.de (Postfix) with ESMTPS id 14639CD; Fri, 23 Sep 2022 16:12:16 +0200 (CEST) Received: by mail.in.tum.de (Postfix, from userid 112) id 11A9A4A038D; Fri, 23 Sep 2022 16:12:16 +0200 (CEST) Received: (Authenticated sender: neumann) by mail.in.tum.de (Postfix) with ESMTPSA id CA8804A00CE; Fri, 23 Sep 2022 16:12:15 +0200 (CEST) (Extended-Queue-bit xtech_px@fff.in.tum.de) Message-ID: Date: Fri, 23 Sep 2022 16:12:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] Avoid depending on destructor order Content-Language: en-US To: David Edelsohn Cc: Jason Merrill , GCC Patches References: <88e489d8-4248-75de-6e8e-af6f152da61b@in.tum.de> From: Thomas Neumann In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_NONE,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 List-Id: > > +static const bool in_shutdown = false; > > 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". 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. 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. Best Thomas 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. 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. libgcc/ChangeLog: * unwind-dw2-fde.c: Introduce a constant for in_shutdown for the non-fast-path case. 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); #else +/* Without fast path frame deregistration must always succeed. */ +static const int in_shutdown = 0; /* The unseen_objects list contains objects that have been registered but not yet categorized in any way. The seen_objects list has had