From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 2289C3858CDA for ; Sun, 25 Sep 2022 15:29:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2289C3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x42b.google.com with SMTP id y136so4493568pfb.3 for ; Sun, 25 Sep 2022 08:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=jBwTGhVhtz2i02HneOrR2IU6frpOimHU9DWFVPfO4Ow=; b=k/gX0/dhxhvw3G1tSAv4PrvGMSHPgXhg59577X/b1tdOJwCxNs3ZUcCWyCvA79G3Mp SyW6NB+vyfH0nVmBmpeHiHFdpzYg5ZYKEWgk9HMofqSxe9vr7rXwKC5JYl23eG9nQx0g htTVX2RmSDl3j42/jK2zdvuhbtKV+2lFuf2q0y39NjpnO+NCfFvPkisdEME1djldWswW ikkvsdH7j1lgWLoblvNGRd4Ejy5dRuie8O2M992GXLRc9s0vA1WLEHr/BbdWYh258qip k2WE0V2Ay/OCFyfDkwYJzhtq9F0KB+ZH5eYVtBcQqp16SKZ/PU4QSoOSrHG1R2Tey/Ds JKSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=jBwTGhVhtz2i02HneOrR2IU6frpOimHU9DWFVPfO4Ow=; b=FyDIqbps/aK5Dwnx7YeaQ2mBZjuJH3u6VuPEIE4nU52b6UFy/M0X8ktK6t8npyMRmc CPKj3UUSE8gJo5us0GcpXepHmTKozAuiYEaUWW/xXhxNqGcselVR/nYBVkDA21ChiYxL lnVja0EtcRRwLG0FFqN/J+OqOms0+hFhqpwWGtuqo69Fj9yGbyhSvd2QZOpGWgZxK79/ bNc9921oUtBeD5L4LmLfppuKctYmDtz2AwH1cvBj9IQrrNQiThtshO5gKiQ3EFvRW2xF tKUH0yvfVO4oFwpvB6UrcEdVkwCcaFkuQFPlAK089qheLpn0qW9VuwsVZPM8JpNZgRbA /hvg== X-Gm-Message-State: ACrzQf3t2Z9NzQUlU4zmygQjgnp/QWqjxd4DbiTLv1e0cAadjNWIRhkS HY09ykQFkUKlnQJwUqziqGlED7VXJhcspw== X-Google-Smtp-Source: AMsMyM6NeYU9HjzYlLGQt2eXEDc0MrkCdGEVtF+REvoCbS6+yo+am+Th9CxAbiPb2uNKVyXfLKLPww== X-Received: by 2002:a63:6e8e:0:b0:430:3886:3a20 with SMTP id j136-20020a636e8e000000b0043038863a20mr16482446pgc.604.1664119789375; Sun, 25 Sep 2022 08:29:49 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id e13-20020a63db0d000000b0041cd5ddde6fsm8959251pgg.76.2022.09.25.08.29.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Sep 2022 08:29:48 -0700 (PDT) Message-ID: <81a56a51-6f1b-2150-a7bd-1d7d07095b24@gmail.com> Date: Sun, 25 Sep 2022 09:29:44 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH] Avoid depending on destructor order Content-Language: en-US To: gcc-patches@gcc.gnu.org References: <88e489d8-4248-75de-6e8e-af6f152da61b@in.tum.de> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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: On 9/25/22 00:29, Iain Sandoe wrote: > >> On 23 Sep 2022, at 15:30, David Edelsohn via Gcc-patches wrote: >> >> On Fri, Sep 23, 2022 at 10:12 AM Thomas Neumann wrote: >> >>>> +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 >>> >> 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, I'm using it in the automated tester as well -- without all the *-elf targets would fail to build libgcc. jeff