public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Jeff Law <jeffreyalaw@gmail.com>
Subject: Re: [PATCH] Avoid depending on destructor order
Date: Mon, 26 Sep 2022 09:55:05 +0200	[thread overview]
Message-ID: <ydd1qryo9ie.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)
In-Reply-To: <81a56a51-6f1b-2150-a7bd-1d7d07095b24@gmail.com> (Jeff Law via Gcc-patches's message of "Sun, 25 Sep 2022 09:29:44 -0600")

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

Hi Jeff,

>>> 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.

things are even worse on targets that lack constructor priority support,
like Solaris 11.3 and Mac OS X 10.7/Darwin 11:

In file included from /vol/gcc/src/hg/master/local/libgcc/unwind-dw2-fde-dip.c:97:
/vol/gcc/src/hg/master/local/libgcc/unwind-dw2-fde.c:54:1: error: destructor priorities are not supported
   54 | release_registered_frames (void) __attribute__ ((destructor (110)));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~

This is already checked for in libgcc/configure, and the situation
handled in libgcc/config/i386/cpuinfo.c.  The following patch unbroke
bootstrap on both affected targets and I saw no apparent regressions.
However, I cannot tell if the destructor priority is actually required
for correctness.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: udf.patch --]
[-- Type: text/x-patch, Size: 637 bytes --]

diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c
--- a/libgcc/unwind-dw2-fde.c
+++ b/libgcc/unwind-dw2-fde.c
@@ -47,11 +47,17 @@ typedef __UINTPTR_TYPE__ uintptr_type;
 #ifdef ATOMIC_FDE_FAST_PATH
 #include "unwind-dw2-btree.h"
 
+#ifdef HAVE_INIT_PRIORITY
+#define DESTRUCTOR_PRIORITY (110)
+#else
+#define DESTRUCTOR_PRIORITY
+#endif
+
 static struct btree registered_frames;
 static bool in_shutdown;
 
 static void
-release_registered_frames (void) __attribute__ ((destructor (110)));
+release_registered_frames (void) __attribute__ ((destructor DESTRUCTOR_PRIORITY));
 static void
 release_registered_frames (void)
 {

  reply	other threads:[~2022-09-26  7:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-09-27  0:17       ` Jason Merrill
2022-09-23 14:11   ` David Edelsohn
  -- strict thread matches above, loose matches on Subject: below --
2022-09-19 16:20 Thomas Neumann
2022-09-22 22:22 ` Jason Merrill
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

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=ydd1qryo9ie.fsf@CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.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).