From: Iain Sandoe Date: Mon, 25 Sep 2017 08:47:41 +0000 (+0000) Subject: [Patch, Darwin] Fix PR80556 by linking the system unwinder ahead of libgcc_eh. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b6078223126fb3927b8199d9048e4f0cccc17e9;p=gcc.git [Patch, Darwin] Fix PR80556 by linking the system unwinder ahead of libgcc_eh. PR target/80556 * config/i386/darwin.h (REAL_LIB_SPEC): New; put libSystem ahead of libgcc_eh for m64. * config/i386/darwin64.h: Likewise. /* 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. From-SVN: r253137 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc82092dc5b..aae06a1e87c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-09-25 Iain Sandoe + + PR target/80556 + * config/i386/darwin.h (REAL_LIB_SPEC): New; put libSystem ahead + of libgcc_eh for m64. + * config/i386/darwin64.h: Likewise. + 2017-09-25 Richard Biener PR middle-end/82144 diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index fccaf7eb94b..321ed27fa3a 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 f2982edeac3..32cb789c191 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