Move Darwin10 unwinder fix to a crt shim.
authorIain Sandoe <iain@sandoe.co.uk>
Wed, 22 Aug 2018 11:58:43 +0000 (11:58 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Wed, 22 Aug 2018 11:58:43 +0000 (11:58 +0000)
gcc/
* config/darwin10.h (LINK_GCC_C_SEQUENCE_SPEC): Adjust to use the
Darwin10-specific unwinder-shim.
* config/darwin12.h (LINK_GCC_C_SEQUENCE_SPEC): Remove.
* config/rs6000/darwin.h (DARWIN_CRT1_SPEC, DARWIN_DYLIB1_SPEC):
New to cater for Darwin10 Rosetta.

libgcc/
* config/unwind-dw2-fde-darwin.c
(_darwin10_Unwind_FindEnclosingFunction): move from here ...
* config/darwin10-unwind-find-enc-func.c: … to here.
* config/t-darwin: Build Darwin10 unwinder shim crt.
* libgcc/config.host: Add the Darwin10 unwinder shim.

From-SVN: r263765

gcc/ChangeLog
gcc/config/darwin10.h
gcc/config/darwin12.h
gcc/config/rs6000/darwin.h
libgcc/ChangeLog
libgcc/config/darwin10-unwind-find-enc-func.c [new file with mode: 0644]
libgcc/config/t-darwin
libgcc/config/unwind-dw2-fde-darwin.c

index a3c675352dd96a3990f42b66f50fe7469e62879a..0b8adf559a510c26eb9bb6c3bd4794dbe3d2dcb2 100644 (file)
@@ -1,3 +1,11 @@
+2018-08-22  Iain Sandoe  <iain@sandoe.co.uk>
+
+       * config/darwin10.h (LINK_GCC_C_SEQUENCE_SPEC): Adjust to use the
+       Darwin10-specific unwinder-shim.
+       * config/darwin12.h (LINK_GCC_C_SEQUENCE_SPEC): Remove.
+       * config/rs6000/darwin.h (DARWIN_CRT1_SPEC, DARWIN_DYLIB1_SPEC): 
+       New to cater for Darwin10 Rosetta.
+
 2018-08-22  Iain Sandoe  <iain@sandoe.co.uk>
 
        * config/i386/i386.c (ix86_output_addr_diff_elt): Move the MACH-O
        PR target/81733
        PR target/52795
        * gcc/dwarf2out.c (FUNC_SECOND_SECT_LABEL): New.
-       (dwarf2out_switch_text_section): Generate a local label for the second
-       function sub-section and apply it as the second FDE start label.
-       * gcc/final.c (final_scan_insn_1): Emit second FDE label after the second
-       sub-section start.
+       (dwarf2out_switch_text_section): Generate a local label for the
+       second function sub-section and apply it as the second FDE start
+       label.
+       * gcc/final.c (final_scan_insn_1): Emit second FDE label after the
+       second sub-section start.
 
 2018-08-22  Richard Biener  <rguenther@suse.de>
 
index d61eb40b8ff2f55e4dd6a65aa8d91af6bc30f450..df694299adae2c9a592add1b9a119d474c9a9663 100644 (file)
@@ -25,10 +25,12 @@ along with GCC; see the file COPYING3.  If not see
 #undef  LINK_GCC_C_SEQUENCE_SPEC
 #define LINK_GCC_C_SEQUENCE_SPEC \
 "%:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) \
-   %{!static:%{!static-libgcc: \
-      %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) } } \
-   %{fno-pic|fno-PIC|fno-pie|fno-PIE|fapple-kext|mkernel|static|mdynamic-no-pic: \
-      %:version-compare(>= 10.7 mmacosx-version-min= -no_pie) } %G %{!nolibc:%L}"
+ %{!static:%{!static-libgcc: \
+    %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) } } \
+ %{fno-pic|fno-PIC|fno-pie|fno-PIE|fapple-kext|mkernel|static|mdynamic-no-pic: \
+   %:version-compare(>= 10.7 mmacosx-version-min= -no_pie) } \
+ %{!nostdlib:%:version-compare(>< 10.6 10.7 mmacosx-version-min= -ld10-uwfef.o)} \
+  %G %{!nolibc:%L}"
 
 #undef DEF_MIN_OSX_VERSION
 #define DEF_MIN_OSX_VERSION "10.6"
index e1e1eb085a217d25ce54b8593b6b5a8c14caa8e6..adc9a78d3767cb9fea289817ae515721a317fb1b 100644 (file)
@@ -18,14 +18,6 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#undef  LINK_GCC_C_SEQUENCE_SPEC
-#define LINK_GCC_C_SEQUENCE_SPEC \
-"%:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) \
-   %{!static:%{!static-libgcc: \
-      %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) } } \
-   %{fno-pic|fno-PIC|fno-pie|fno-PIE|fapple-kext|mkernel|static|mdynamic-no-pic: \
-      %:version-compare(>= 10.7 mmacosx-version-min= -no_pie) } %G %{!nolibc:%L}"
-
 #undef DEF_MIN_OSX_VERSION
 #define DEF_MIN_OSX_VERSION "10.8"
 
index cea1aa94b0cac6cdef6cb72e00e4a8741a7d4e0e..6b0f18e1189cdc042bcfcf19ff1d15a2c13a13c3 100644 (file)
@@ -119,6 +119,13 @@ extern int darwin_emit_branch_islands;
    mcpu=G5:ppc970;                             \
    :ppc}}"
 
+/* We need to jam the crt to 10.5 for 10.6 (Rosetta) use.  */
+#undef DARWIN_CRT1_SPEC
+#define DARWIN_CRT1_SPEC                                               \
+  "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o)            \
+   %:version-compare(>< 10.5 10.7 mmacosx-version-min= -lcrt1.10.5.o)  \
+   %{fgnu-tm: -lcrttms.o}"
+
 /* crt2.o is at least partially required for 10.3.x and earlier.  */
 #define DARWIN_CRT2_SPEC \
   "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}"
@@ -130,6 +137,12 @@ extern int darwin_emit_branch_islands;
   { "darwin_crt2", DARWIN_CRT2_SPEC },         \
   { "darwin_subarch", DARWIN_SUBARCH_SPEC },
 
+/* We need to jam the dylib crt to 10.5 for 10.6 (Rosetta) use.  */
+#undef DARWIN_DYLIB1_SPEC
+#define DARWIN_DYLIB1_SPEC                                             \
+  "%:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o)          \
+   %:version-compare(>< 10.5 10.7 mmacosx-version-min= -ldylib1.10.5.o)"
+
 /* Output a .machine directive.  */
 #undef TARGET_ASM_FILE_START
 #define TARGET_ASM_FILE_START rs6000_darwin_file_start
index 1cfba4c5d59dcff69a7e382acbb3eb303a665c1e..d003fd54c6e979c20f30644ef1120fdd878bbf67 100644 (file)
@@ -1,3 +1,11 @@
+2018-08-22  Iain Sandoe  <iain@sandoe.co.uk>
+
+       * config/unwind-dw2-fde-darwin.c 
+       (_darwin10_Unwind_FindEnclosingFunction): move from here ...
+       * config/darwin10-unwind-find-enc-func.c: … to here.
+       * config/t-darwin: Build Darwin10 unwinder shim crt.
+       * libgcc/config.host: Add the Darwin10 unwinder shim.
+
 2018-08-21  Rasmus Villemoes  <rv@rasmusvillemoes.dk>
 
        * config.host: Add crtbegin.o and crtend.o for
diff --git a/libgcc/config/darwin10-unwind-find-enc-func.c b/libgcc/config/darwin10-unwind-find-enc-func.c
new file mode 100644 (file)
index 0000000..67c4375
--- /dev/null
@@ -0,0 +1,13 @@
+#include "tconfig.h"
+#include "tsystem.h"
+#include "unwind-dw2-fde.h"
+
+void *
+_darwin10_Unwind_FindEnclosingFunction (void *pc)
+{
+  struct dwarf_eh_bases bases;
+  const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases);
+  if (fde)
+    return bases.func;
+  return NULL;
+}
index 13ca6ed99d3f58df474c5f2cd0dd1d04385feab9..8340ea2bfe4b894a9a00e5885ef851cbe842fba1 100644 (file)
@@ -20,3 +20,7 @@ HOST_LIBGCC2_CFLAGS += -pipe
 # Use unwind-dw2-fde-darwin
 LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/config/unwind-dw2-fde-darwin.c \
   $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
+
+# Patch to __Unwind_Find_Enclosing_Function for Darwin10.
+d10-uwfef.o: $(srcdir)/config/darwin10-unwind-find-enc-func.c
+       $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -mmacosx-version-min=10.6 -c $<
index 6e2d0d6d8b200e78ab2dab08f3d0ac8ed0beec4b..c919de9abebd28ff97aedd98cfe715cb3f7dbd51 100644 (file)
@@ -273,16 +273,3 @@ _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
                                          the_obj_info);
   return ret;
 }
-
-void *
-_darwin10_Unwind_FindEnclosingFunction (void *pc ATTRIBUTE_UNUSED)
-{
-#if __MACH__ && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060)
-  struct dwarf_eh_bases bases;
-  const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases);
-  if (fde)
-    return bases.func;
-#endif
-  return NULL;
-}
-