From: Iain Sandoe <iain@codesourcery.com>
To: Mike Stump <mikestump@comcast.net>, Jeff Law <law@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR target/80556
Date: Fri, 22 Sep 2017 09:55:00 -0000 [thread overview]
Message-ID: <89ED08B5-653B-48C7-A334-2219266DC9CE@codesourcery.com> (raw)
In-Reply-To: <C0E30AC7-FF9F-4448-9842-42A49C7E309B@pushface.org>
[-- Attachment #1: Type: text/plain, Size: 1412 bytes --]
> On 18 Sep 2017, at 22:08, Simon Wright <simon@pushface.org> wrote:
>
> On 18 Sep 2017, at 21:09, Iain Sandoe <iain@codesourcery.com> wrote:
>>
>>> If I propose this alternative patch, should it be a new post, or should I continue this thread?
>>
>> thanks for the patch.
>>
>> The basic idea seems sound - as a workaround (as noted in comment #20 in the PR, we should really rationalise the libgcc/crts stuff to reflect the modern world, but these things take time...).
>>
>> The patch as you have it would apply to every version of Darwin.
>>
>> AFAICT from the published sources, i386 Darwin should be able to work with the libgcc unwinder (and all earlier Darwin *have* to) - so I’ve proposed a modified patch in the PR that makes the changes specific to m64 x86 and doesn’t make any alteration for PPC and/or Darwin < 10.
>
> That sounds like the right thing to do. I hadn't considered the older hardware/os issues (I only have kit back to macOS 10.11, Darwin 15).
So here’s the revised version with the comments slightly updated, checked Darwin10,15,16 x86_64 and i386 in progress,
OK if i386 succeeds?
Iain Sandoe
CodeSourcery / Mentor Embedded / Siemens
gcc/
2017-09-xx Iain Sandoe <iain@codesourcery.com>
PR target/80556
* config/i386/darwin.h (REAL_LIB_SPEC): New; put libSystem ahead of libgcc_eh
for m64.
* config/i386/darwin64.h: Likewise.
[-- Attachment #2: pr80556-v2.txt --]
[-- Type: text/plain, Size: 3766 bytes --]
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index fccaf7e..321ed27 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -39,6 +39,32 @@ along with GCC; see the file COPYING3. If not see
#endif
#endif
+/* WORKAROUND pr80556:
+ For x86_64 Darwin10 and later, the unwinder is in libunwind (redirected
+ from libSystem). This doesn't use the keymgr (see keymgr.c) and therefore
+ the calls that libgcc makes to obtain the KEYMGR_GCC3_DW2_OBJ_LIST are not
+ updated to include new images, and might not even be valid for a single
+ image.
+ Therefore, for 64b exes at least, we must use the libunwind implementation,
+ even when static-libgcc is specified. We put libSystem first so that
+ unwinder symbols are satisfied from there. */
+#undef REAL_LIBGCC_SPEC
+#define REAL_LIBGCC_SPEC \
+ "%{static-libgcc|static: \
+ %{m64:%:version-compare(>= 10.6 mmacosx-version-min= -lSystem)} \
+ -lgcc_eh -lgcc; \
+ shared-libgcc|fexceptions|fgnu-runtime: \
+ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \
+ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \
+ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \
+ %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \
+ -lgcc ; \
+ :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
+ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \
+ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \
+ %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \
+ -lgcc }"
+
/* Size of the Obj-C jump buffer. */
#define OBJC_JBLEN ((TARGET_64BIT) ? ((9 * 2) + 3 + 16) : (18))
diff --git a/gcc/config/i386/darwin64.h b/gcc/config/i386/darwin64.h
index f2982ed..32cb789 100644
--- a/gcc/config/i386/darwin64.h
+++ b/gcc/config/i386/darwin64.h
@@ -21,6 +21,32 @@ along with GCC; see the file COPYING3. If not see
#undef DARWIN_ARCH_SPEC
#define DARWIN_ARCH_SPEC "%{m32:i386;:x86_64}"
+/* WORKAROUND pr80556:
+ For x86_64 Darwin10 and later, the unwinder is in libunwind (redirected
+ from libSystem). This doesn't use the keymgr (see keymgr.c) and therefore
+ the calls that libgcc makes to obtain the KEYMGR_GCC3_DW2_OBJ_LIST are not
+ updated to include new images, and might not even be valid for a single
+ image.
+ Therefore, for 64b exes at least, we must use the libunwind implementation,
+ even when static-libgcc is specified. We put libSystem first so that
+ unwinder symbols are satisfied from there. */
+#undef REAL_LIBGCC_SPEC
+#define REAL_LIBGCC_SPEC \
+ "%{static-libgcc|static: \
+ %{!m32:%:version-compare(>= 10.6 mmacosx-version-min= -lSystem)} \
+ -lgcc_eh -lgcc; \
+ shared-libgcc|fexceptions|fgnu-runtime: \
+ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \
+ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \
+ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \
+ %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \
+ -lgcc ; \
+ :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
+ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \
+ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \
+ %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \
+ -lgcc }"
+
#undef DARWIN_SUBARCH_SPEC
#define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC
[-- Attachment #3: Type: text/plain, Size: 4 bytes --]
next prev parent reply other threads:[~2017-09-22 9:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 13:57 Simon Wright
2017-06-28 17:40 ` Jeff Law
2017-06-29 20:41 ` Simon Wright
2017-09-01 13:03 ` Simon Wright
2017-09-18 20:10 ` Iain Sandoe
2017-09-18 21:08 ` Simon Wright
2017-09-22 9:55 ` Iain Sandoe [this message]
2017-09-24 16:06 ` Mike Stump
2017-06-28 21:36 ` Mike Stump
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=89ED08B5-653B-48C7-A334-2219266DC9CE@codesourcery.com \
--to=iain@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
--cc=mikestump@comcast.net \
/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).