From: Jason Merrill <jason@redhat.com>
To: Thomas Neumann <neumann@in.tum.de>, gcc-patches@gcc.gnu.org
Cc: Stephan Bergmann <sbergman@redhat.com>
Subject: Re: [PATCH] Avoid depending on destructor order
Date: Thu, 22 Sep 2022 18:22:38 -0400 [thread overview]
Message-ID: <b63484f7-df05-1ac2-2834-4b49f4b0b832@redhat.com> (raw)
In-Reply-To: <5aba5553-ed71-50a8-e934-6e94f3a1057e@in.tum.de>
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;
> }
>
next prev parent reply other threads:[~2022-09-22 22:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-19 16:20 Thomas Neumann
2022-09-22 22:22 ` Jason Merrill [this message]
2022-09-26 11:46 ` Claudiu Zissulescu Ianculescu
2022-09-26 11:49 ` Thomas Neumann
2022-09-26 11:50 ` Claudiu Zissulescu Ianculescu
2022-09-26 12:53 ` Iain Sandoe
2022-09-26 13:14 ` Thomas Neumann
2022-09-23 13:25 David Edelsohn
2022-09-23 13:38 ` Thomas Neumann
2022-09-23 14:01 ` David Edelsohn
2022-09-23 14:12 ` Thomas Neumann
2022-09-23 14:30 ` David Edelsohn
2022-09-25 6:29 ` Iain Sandoe
2022-09-25 15:29 ` Jeff Law
2022-09-26 7:55 ` Rainer Orth
2022-09-27 0:17 ` Jason Merrill
2022-09-23 14:11 ` David Edelsohn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b63484f7-df05-1ac2-2834-4b49f4b0b832@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=neumann@in.tum.de \
--cc=sbergman@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).