From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 5F88B3858D38 for ; Thu, 22 Sep 2022 22:22:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F88B3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663885361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qL1j3QmrU+VDqYHilHzt2iEdo5L5Sgo9hz0m4TI15Ts=; b=QZQ0ujY8kbiP1lZc0umoIkFUJCLKreuiRn4ZHFEq7I9jGRQOEXYnIeU0xdhlw2h/MV0uDY 86xSfk8CnLBdrUsZgXAURVnZll26d5xrxIzu308EgwpQJCWXiQxzYVGJYgNo9ljwnNqTZV Y6F3kj7LE+vkA/vtSLZLqSlgQ2OO9wo= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-39-UZ0ef4uiPtCDkTQu2DBPGQ-1; Thu, 22 Sep 2022 18:22:39 -0400 X-MC-Unique: UZ0ef4uiPtCDkTQu2DBPGQ-1 Received: by mail-qt1-f200.google.com with SMTP id b10-20020ac8540a000000b0035ba387b0d1so7432906qtq.15 for ; Thu, 22 Sep 2022 15:22:39 -0700 (PDT) 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:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=qL1j3QmrU+VDqYHilHzt2iEdo5L5Sgo9hz0m4TI15Ts=; b=nUUXzGlMXRO0Qvz8KlyWFASBWc9bMAr1TtzX4mln4KYds6C5avy+knP9eeJvbdZOPi +MgTxfaxwEVR0pnU2WMeT2NXK6lMEgWBHfbU/DMPKSm3bDpA4kvH4QxhxxuYs3nypfjV ZWEV6VvFyx6m7+2plBIeZrxNg99DY2Ed3ueDRLOZDpCW3OlKPDpfBXQQh1/8SCa+efhL VMaksnC1mwEZ6riv8Nvlsue71sgrN4AMZix1ajKNr5a1y+bA38Fy9hjWNMaEl6Udo0/s 0xnbXsc+KQLZnkrJcnZLVL6ZaYhX2C7ikt/0MMYr/WQyrm8FNpF7WUNvyyrXgK9ieoU/ tJKA== X-Gm-Message-State: ACrzQf3jx9kylrlzNccxm8R9II0xDOpLXItYJY4wAVcDNoPWSw9P3JHN 6tkqwegugHFbeZE4amuH97oDr8s4KSYSo7UuE2f9budBmQF9fsI5SnaHmjklApP7b2ibRzXwyAo v7cj8dsotkE9YcGi2Fw== X-Received: by 2002:a05:620a:3722:b0:6be:9f84:4c71 with SMTP id de34-20020a05620a372200b006be9f844c71mr3732751qkb.138.1663885359452; Thu, 22 Sep 2022 15:22:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7purR8fYCU7NDNUWTBsuC02yVOFVgH299Urw2G/E1tPPFW2bPr8kyw1qJ8VQiNkC4Hy+Qkpw== X-Received: by 2002:a05:620a:3722:b0:6be:9f84:4c71 with SMTP id de34-20020a05620a372200b006be9f844c71mr3732747qkb.138.1663885359180; Thu, 22 Sep 2022 15:22:39 -0700 (PDT) Received: from [192.168.1.101] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id m19-20020a05620a24d300b006be8713f742sm5193654qkn.38.2022.09.22.15.22.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Sep 2022 15:22:38 -0700 (PDT) Message-ID: Date: Thu, 22 Sep 2022 18:22:38 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH] Avoid depending on destructor order To: Thomas Neumann , gcc-patches@gcc.gnu.org Cc: Stephan Bergmann References: <5aba5553-ed71-50a8-e934-6e94f3a1057e@in.tum.de> From: Jason Merrill In-Reply-To: <5aba5553-ed71-50a8-e934-6e94f3a1057e@in.tum.de> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,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 9/19/22 12:20, Thomas Neumann wrote: > In some scenarios (e.g., when mixing gcc and clang code), it can > happen that frames are deregistered after the lookup structure > has already been destroyed. That in itself would be fine, but > it triggers an assert in __deregister_frame_info_bases that > expects to find the frame. > > To avoid that, we now remember that the btree as already been > destroyed and disable the assert in that case. OK. > libgcc/ChangeLog: > >     * unwind-dw2-fde.c: (release_register_frames) Remember >     when the btree has been destroyed. >     (__deregister_frame_info_bases) Disable the assert when >     shutting down. > --- >  libgcc/unwind-dw2-fde.c | 4 +++- >  1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c > index 919abfe0664..d237179f4ea 100644 > --- a/libgcc/unwind-dw2-fde.c > +++ b/libgcc/unwind-dw2-fde.c > @@ -48,6 +48,7 @@ typedef __UINTPTR_TYPE__ uintptr_type; >  #include "unwind-dw2-btree.h" > >  static struct btree registered_frames; > +static bool in_shutdown; > >  static void >  release_registered_frames (void) __attribute__ ((destructor (110))); > @@ -57,6 +58,7 @@ release_registered_frames (void) >    /* Release the b-tree and all frames. Frame releases that happen > later are >     * silently ignored */ >    btree_destroy (®istered_frames); > +  in_shutdown = true; >  } > >  static void > @@ -282,7 +284,7 @@ __deregister_frame_info_bases (const void *begin) >    __gthread_mutex_unlock (&object_mutex); >  #endif > > -  gcc_assert (ob); > +  gcc_assert (in_shutdown || ob); >    return (void *) ob; >  } >