summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config/darwin.h72
-rw-r--r--gcc/config/rs6000/darwin.h27
-rw-r--r--libgcc/ChangeLog13
-rw-r--r--libgcc/config.host6
-rw-r--r--libgcc/config/rs6000/t-darwin14
-rw-r--r--libgcc/config/rs6000/t-darwin646
-rw-r--r--libgcc/config/t-darwin12
8 files changed, 113 insertions, 51 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f1b830b894b..cc3a2ab6c03 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,20 @@
2019-11-01 Iain Sandoe <iain@sandoe.co.uk>
Backport from mainline
+ 2019-07-03 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin.h (REAL_LIBGCC_SPEC): Adjust for earlier Darwin.
+ (STARTFILE_SPEC): Split crt3 into a separate spec.
+ (DARWIN_EXTRA_SPECS): Add crt2 and crt3 spec.
+ (DARWIN_CRT2_SPEC): New.
+ (DARWIN_CRT3_SPEC): New.
+ (MIN_LD64_OMIT_STUBS): Revise to 62.1.
+ * config/rs6000/darwin.h (DARWIN_CRT2_SPEC): Revise conditions.
+ (DARWIN_CRT3_SPEC): New.
+
+2019-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ Backport from mainline
2019-06-27 Iain Sandoe <iain@sandoe.co.uk>
* config/rs6000/darwin.h (ENDFILE_SPEC): Correct whitespace in the
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index b83e36aeecd..d2336c2e84a 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -185,8 +185,15 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_NOCOMPACT_UNWIND \
" %:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) "
-/* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus
- precomp, libtool, and fat build additions.
+/* In Darwin linker specs we can put -lcrt0.o and ld will search the library
+ path for crt0.o or -lcrtx.a and it will search for for libcrtx.a. As for
+ other ports, we can also put xxx.{o,a}%s and get the appropriate complete
+ startfile absolute directory. This latter point is important when we want
+ to override ld's rule of .dylib being found ahead of .a and the user wants
+ the convenience library to be linked. */
+
+/* The LINK_COMMAND spec is mostly a clone of the standard LINK_COMMAND_SPEC,
+ plus precomp, libtool, and fat build additions.
In general, random Darwin linker flags should go into LINK_SPEC
instead of LINK_COMMAND_SPEC. The command spec is better for
@@ -352,43 +359,42 @@ extern GTY(()) int darwin_ms_struct;
/* Support -mmacosx-version-min by supplying different (stub) libgcc_s.dylib
libraries to link against, and by not linking against libgcc_s on
- earlier-than-10.3.9.
+ earlier-than-10.3.9. If we need exceptions, prior to 10.3.9, then we have
+ to link the static eh lib, since there's no shared version on the system.
+
+ Note that by default, except as above, -lgcc_eh is not linked against.
+ This is because,in general, we need to unwind through system libraries that
+ are linked with the shared unwinder in libunwind (or libgcc_s for 10.4/5).
- Note that by default, -lgcc_eh is not linked against! This is
- because in a future version of Darwin the EH frame information may
- be in a new format, or the fallback routine might be changed; if
- you want to explicitly link against the static version of those
- routines, because you know you don't need to unwind through system
- libraries, you need to explicitly say -static-libgcc.
+ The static version of the current libgcc unwinder (which differs from the
+ implementation in libunwind.dylib on systems Darwin10 [10.6]+) can be used
+ by specifying -static-libgcc.
- If it is linked against, it has to be before -lgcc, because it may
+ If libgcc_eh is linked against, it has to be before -lgcc, because it might
need symbols from -lgcc. */
+
#undef REAL_LIBGCC_SPEC
#define REAL_LIBGCC_SPEC \
"%{static-libgcc|static: -lgcc_eh -lgcc; \
- shared-libgcc|fexceptions|fgnu-runtime: \
- %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \
+ shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime: \
+ %:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh) \
+ %: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.3.9 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.3.9 10.5 mmacosx-version-min= -lgcc_ext.10.4) \
%:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \
-lgcc }"
-/* We specify crt0.o as -lcrt0.o so that ld will search the library path.
-
- crt3.o provides __cxa_atexit on systems that don't have it. Since
- it's only used with C++, which requires passing -shared-libgcc, key
- off that to avoid unnecessarily adding a destructor to every
- powerpc program built. */
+/* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
- "%{Zdynamiclib: %(darwin_dylib1) %{fgnu-tm: -lcrttms.o}} \
- %{!Zdynamiclib:%{Zbundle:%{!static: \
+"%{Zdynamiclib: %(darwin_dylib1) %{fgnu-tm: -lcrttms.o}} \
+ %{!Zdynamiclib:%{Zbundle:%{!static: \
%:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o) \
%{fgnu-tm: -lcrttms.o}}} \
%{!Zbundle:%{pg:%{static:-lgcrt0.o} \
@@ -402,7 +408,7 @@ extern GTY(()) int darwin_ms_struct;
%{!object:%{preload:-lcrt0.o} \
%{!preload: %(darwin_crt1) \
%(darwin_crt2)}}}}}} \
- %{shared-libgcc:%:version-compare(< 10.5 mmacosx-version-min= crt3.o%s)}"
+ %(darwin_crt3)"
/* We want a destructor last in the list. */
#define TM_DESTRUCTOR "%{fgnu-tm: -lcrttme.o}"
@@ -410,18 +416,30 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_EXTRA_SPECS \
{ "darwin_crt1", DARWIN_CRT1_SPEC }, \
+ { "darwin_crt2", DARWIN_CRT2_SPEC }, \
+ { "darwin_crt3", DARWIN_CRT3_SPEC }, \
{ "darwin_dylib1", DARWIN_DYLIB1_SPEC },
-#define DARWIN_DYLIB1_SPEC \
- "%:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o) \
- %:version-compare(>< 10.5 10.6 mmacosx-version-min= -ldylib1.10.5.o)"
-
#define DARWIN_CRT1_SPEC \
"%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
%:version-compare(>< 10.5 10.6 mmacosx-version-min= -lcrt1.10.5.o) \
%:version-compare(>< 10.6 10.8 mmacosx-version-min= -lcrt1.10.6.o) \
%{fgnu-tm: -lcrttms.o}"
+#define DARWIN_CRT2_SPEC ""
+
+/* crt3.o provides __cxa_atexit on systems that don't have it (and a fix
+ up for faulty versions on 10.4). Since it's only used with C++, which
+ requires passing -shared-libgcc, key off that to avoid unnecessarily
+ adding a destructor to every program built for 10.4 or earlier. */
+
+#define DARWIN_CRT3_SPEC \
+"%{shared-libgcc:%:version-compare(< 10.5 mmacosx-version-min= crt3.o%s)}"
+
+#define DARWIN_DYLIB1_SPEC \
+ "%:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o) \
+ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -ldylib1.10.5.o)"
+
#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
/* Emit macosx version (but only major). */
#define ASM_MMACOSX_VERSION_MIN_SPEC \
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 4a9f67f2e93..b6d8e011bce 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -129,9 +129,32 @@
mcpu=G5:ppc970; \
:ppc}"
-/* crt2.o is at least partially required for 10.3.x and earlier. */
+/* 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.
+ It deals with registration of the unwind frames, where this is not
+ automatically provided by the system. So we need it for any case that
+ might use exceptions. */
+#undef DARWIN_CRT2_SPEC
#define DARWIN_CRT2_SPEC \
- "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}"
+"%{!m64:%{shared-libgcc|static-libstdc++|fexceptions|fobjc-exceptions|fgnu-runtime: \
+ %:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s) \
+ }}"
+
+/* crt3 deals with providing cxa_atexit on earlier systems (or fixing it up,
+ for broken versions). It's only needed for c++ code, so we can make it
+ conditional on shared-libgcc since that's forced on for c++. */
+#undef DARWIN_CRT3_SPEC
+#define DARWIN_CRT3_SPEC \
+"%{!m64:%{shared-libgcc|static-libstdc++: \
+ %:version-compare(>< 10.4 10.5 mmacosx-version-min= crt3.o%s) \
+ %:version-compare(!> 10.4 mmacosx-version-min= crt3_2.o%s) \
+ }}"
/* The PPC regs save/restore functions are leaves and could, conceivably
be used by the tm destructor. */
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 129e937dee8..0e6d7dc362d 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,6 +1,19 @@
2019-11-01 Iain Sandoe <iain@sandoe.co.uk>
Backport from mainline.
+ 2019-07-03 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config.host (powerpc-*-darwin*,powerpc64-*-darwin*): Revise crt
+ list.
+ * config/rs6000/t-darwin: Build crt3_2 for older systems. Revise
+ mmacosx-version-min for crts to run across all system versions.
+ * config/rs6000/t-darwin64 (LIB2ADD): Remove.
+ * config/t-darwin: Revise mmacosx-version-min for crts to run across
+ system versions >= 10.4.
+
+2019-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ Backport from mainline.
2019-06-25 Iain Sandoe <iain@sandoe.co.uk>
* config.host: Add libef_ppc.a to the extra files for powerpc-darwin.
diff --git a/libgcc/config.host b/libgcc/config.host
index e38f0c2774d..b8e23766695 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -992,12 +992,12 @@ powerpc-*-darwin*)
md_unwind_header=rs6000/darwin-unwind.h
;;
esac
- tmake_file="$tmake_file rs6000/t-ibm-ldouble"
- extra_parts="$extra_parts crt2.o libef_ppc.a"
+ tmake_file="$tmake_file rs6000/t-ppc64-fp rs6000/t-ibm-ldouble"
+ extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o"
;;
powerpc64-*-darwin*)
tmake_file="$tmake_file rs6000/t-darwin64 rs6000/t-ibm-ldouble"
- extra_parts="$extra_parts crt2.o libef_ppc.a"
+ extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o"
;;
powerpc*-*-freebsd*)
tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-freebsd t-softfp-sfdf t-softfp-excl t-softfp"
diff --git a/libgcc/config/rs6000/t-darwin b/libgcc/config/rs6000/t-darwin
index 0c238b7a7e8..8b513bdb1d7 100644
--- a/libgcc/config/rs6000/t-darwin
+++ b/libgcc/config/rs6000/t-darwin
@@ -1,7 +1,11 @@
-DARWIN_EXTRA_CRT_BUILD_CFLAGS = -mlongcall -mmacosx-version-min=10.4
crt2.o: $(srcdir)/config/rs6000/darwin-crt2.c
- $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $<
+ $(crt_compile) -mmacosx-version-min=10.1 -c $<
+
+# The sources for this indicate that there are some parts that
+# don't apply >= 10.4
+crt3_2.o: $(srcdir)/config/darwin-crt3.c
+ $(crt_compile) -mmacosx-version-min=10.1 -c $<
# The outlined register save/restore functions need to run anywhere, and
# they must be leaf functions suitable for use in an endfile.
@@ -32,10 +36,12 @@ libef_ppc.a: $(PPC_ENDFILE_OBJS)
$(AR_CREATE_FOR_TARGET) $@ $(PPC_ENDFILE_OBJS)
$(RANLIB_FOR_TARGET) $@
+dw_ppc.o: $(srcdir)/config/rs6000/darwin-world.S
+ $(crt_compile) -mmacosx-version-min=10.1 -c $<
+
LIB2ADD = $(srcdir)/config/rs6000/darwin-tramp.S \
$(srcdir)/config/darwin-64.c \
- $(srcdir)/config/rs6000/darwin-world.S \
- $(srcdir)/config/rs6000/ppc64-fp.c
+ $(srcdir)/config/rs6000/darwin-world.S
# The .S files above are designed to run on all processors, even though
# they use AltiVec instructions.
diff --git a/libgcc/config/rs6000/t-darwin64 b/libgcc/config/rs6000/t-darwin64
index 50f09d6de1a..999679fc3cb 100644
--- a/libgcc/config/rs6000/t-darwin64
+++ b/libgcc/config/rs6000/t-darwin64
@@ -1,7 +1 @@
LIB2_SIDITI_CONV_FUNCS = yes
-
-LIB2ADD = $(srcdir)/config/rs6000/darwin-tramp.S \
- $(srcdir)/config/darwin-64.c \
- $(srcdir)/config/rs6000/darwin-fpsave.S \
- $(srcdir)/config/rs6000/darwin-gpsave.S \
- $(srcdir)/config/rs6000/darwin-world.S
diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin
index 8ca61d02f3b..d9d268e352f 100644
--- a/libgcc/config/t-darwin
+++ b/libgcc/config/t-darwin
@@ -3,19 +3,13 @@
HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=10.4
crt3.o: $(srcdir)/config/darwin-crt3.c
- $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $<
+ $(crt_compile) -mmacosx-version-min=10.4 -c $<
crttms.o: $(srcdir)/config/darwin-crt-tm.c
- $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -DSTART -c $<
+ $(crt_compile) -mmacosx-version-min=10.4 -DSTART -c $<
crttme.o: $(srcdir)/config/darwin-crt-tm.c
- $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -DEND -c $<
-
-# -pipe because there's an assembler bug, 4077127, which causes
-# it to not properly process the first # directive, causing temporary
-# file names to appear in stabs, causing the bootstrap to fail. Using -pipe
-# works around this by not having any temporary file names.
-HOST_LIBGCC2_CFLAGS += -pipe
+ $(crt_compile) -mmacosx-version-min=10.4 -DEND -c $<
# Use unwind-dw2-fde-darwin
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/config/unwind-dw2-fde-darwin.c \