public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10797] Darwin, libgcc : Adjust min version supported for the OS.
@ 2023-05-21 7:43 Iain D Sandoe
0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2023-05-21 7:43 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1bfdb0d0346082acccd27bfb37d0a72b0f6b8b1d
commit r11-10797-g1bfdb0d0346082acccd27bfb37d0a72b0f6b8b1d
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu May 11 23:24:02 2023 +0100
Darwin, libgcc : Adjust min version supported for the OS.
Tools from later versions of the OS deprecate or fail to support
earlier OS revisions.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libgcc/ChangeLog:
* config.host: Arrange to set min Darwin OS versions from
the configured host version.
* config/darwin10-unwind-find-enc-func.c: Do not use current
headers, but declare the nexessary structures locally to the
versions in use for Mac OSX 10.6.
* config/t-darwin: Amend to handle configured min OS
versions.
* config/t-darwin-min-1: New.
* config/t-darwin-min-5: New.
* config/t-darwin-min-8: New.
(cherry picked from commit 20b8779ea9bd82b26eeb195b30f695168cd7ae1d)
Diff:
---
libgcc/config.host | 18 ++++++++++++++
libgcc/config/darwin10-unwind-find-enc-func.c | 34 +++++++++++++++++++++++----
libgcc/config/t-darwin | 10 ++++----
libgcc/config/t-darwin-min-1 | 3 +++
libgcc/config/t-darwin-min-5 | 3 +++
libgcc/config/t-darwin-min-8 | 3 +++
6 files changed, 63 insertions(+), 8 deletions(-)
diff --git a/libgcc/config.host b/libgcc/config.host
index f2dc7e266f4..45f8e19ada4 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -225,6 +225,24 @@ case ${host} in
;;
esac
tmake_file="$tmake_file t-slibgcc-darwin"
+ # newer toolsets produce warnings when building for unsupported versions.
+ case ${host} in
+ *-*-darwin1[89]* | *-*-darwin2* )
+ tmake_file="t-darwin-min-8 $tmake_file"
+ ;;
+ *-*-darwin9* | *-*-darwin1[0-7]*)
+ tmake_file="t-darwin-min-5 $tmake_file"
+ ;;
+ *-*-darwin[4-8]*)
+ tmake_file="t-darwin-min-1 $tmake_file"
+ ;;
+ *)
+ # Fall back to configuring for the oldest system known to work with
+ # all archs and the current sources.
+ tmake_file="t-darwin-min-5 $tmake_file"
+ echo "Warning: libgcc configured to support macOS 10.5" 1>&2
+ ;;
+ esac
extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a"
;;
*-*-dragonfly*)
diff --git a/libgcc/config/darwin10-unwind-find-enc-func.c b/libgcc/config/darwin10-unwind-find-enc-func.c
index 882ec3a2372..b08396c5f1b 100644
--- a/libgcc/config/darwin10-unwind-find-enc-func.c
+++ b/libgcc/config/darwin10-unwind-find-enc-func.c
@@ -1,8 +1,34 @@
-#include "tconfig.h"
-#include "tsystem.h"
-#include "unwind-dw2-fde.h"
#include "libgcc_tm.h"
+/* This shim is special, it needs to be built for Mac OSX 10.6
+ regardless of the current system version.
+ We must also build it to use the unwinder layout that was
+ present for 10.6 (and not update that).
+ So we copy the referenced structures from unwind-dw2-fde.h
+ to avoid pulling in newer system headers and/or changed
+ layouts. */
+struct dwarf_eh_bases
+{
+ void *tbase;
+ void *dbase;
+ void *func;
+};
+
+typedef int sword __attribute__ ((mode (SI)));
+typedef unsigned int uword __attribute__ ((mode (SI)));
+
+/* The first few fields of an FDE. */
+struct dwarf_fde
+{
+ uword length;
+ sword CIE_delta;
+ unsigned char pc_begin[];
+} __attribute__ ((packed, aligned (__alignof__ (void *))));
+
+typedef struct dwarf_fde fde;
+
+extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
+
void *
_darwin10_Unwind_FindEnclosingFunction (void *pc)
{
@@ -10,5 +36,5 @@ _darwin10_Unwind_FindEnclosingFunction (void *pc)
const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases);
if (fde)
return bases.func;
- return NULL;
+ return (void *) 0;
}
diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin
index 299d26c2c96..a3bb70c6a0a 100644
--- a/libgcc/config/t-darwin
+++ b/libgcc/config/t-darwin
@@ -1,15 +1,15 @@
# Set this as a minimum (unless overriden by arch t-files) since it's a
# reasonable lowest common denominator that works for all our archs.
-HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=10.4
+HOST_LIBGCC2_CFLAGS += $(DARWIN_MIN_LIB_VERSION)
crt3.o: $(srcdir)/config/darwin-crt3.c
- $(crt_compile) -mmacosx-version-min=10.4 -c $<
+ $(crt_compile) $(DARWIN_MIN_CRT_VERSION) -c $<
crttms.o: $(srcdir)/config/darwin-crt-tm.c
- $(crt_compile) -mmacosx-version-min=10.4 -DSTART -c $<
+ $(crt_compile) $(DARWIN_MIN_CRT_VERSION) -DSTART -c $<
crttme.o: $(srcdir)/config/darwin-crt-tm.c
- $(crt_compile) -mmacosx-version-min=10.4 -DEND -c $<
+ $(crt_compile) $(DARWIN_MIN_CRT_VERSION) -DEND -c $<
# Make emutls weak so that we can deal with -static-libgcc, override the
# hidden visibility when this is present in libgcc_eh.
@@ -25,6 +25,8 @@ libemutls_w.a: emutls_s.o
$(RANLIB_FOR_TARGET) $@
# Patch to __Unwind_Find_Enclosing_Function for Darwin10.
+# This needs to be built for darwin10, regardless of the current platform
+# version.
d10-uwfef.o: $(srcdir)/config/darwin10-unwind-find-enc-func.c libgcc_tm.h
$(crt_compile) -mmacosx-version-min=10.6 -c $<
diff --git a/libgcc/config/t-darwin-min-1 b/libgcc/config/t-darwin-min-1
new file mode 100644
index 00000000000..8c2cf8acd39
--- /dev/null
+++ b/libgcc/config/t-darwin-min-1
@@ -0,0 +1,3 @@
+# Support building with -mmacosx-version-min back to 10.1.
+DARWIN_MIN_LIB_VERSION = -mmacosx-version-min=10.4
+DARWIN_MIN_CRT_VERSION = -mmacosx-version-min=10.1
diff --git a/libgcc/config/t-darwin-min-5 b/libgcc/config/t-darwin-min-5
new file mode 100644
index 00000000000..138193151e7
--- /dev/null
+++ b/libgcc/config/t-darwin-min-5
@@ -0,0 +1,3 @@
+# Support building with -mmacosx-version-min back to 10.5.
+DARWIN_MIN_LIB_VERSION = -mmacosx-version-min=10.5
+DARWIN_MIN_CRT_VERSION = -mmacosx-version-min=10.5
diff --git a/libgcc/config/t-darwin-min-8 b/libgcc/config/t-darwin-min-8
new file mode 100644
index 00000000000..9efc9dc0257
--- /dev/null
+++ b/libgcc/config/t-darwin-min-8
@@ -0,0 +1,3 @@
+# Support building with -mmacosx-version-min back to 10.8.
+DARWIN_MIN_LIB_VERSION = -mmacosx-version-min=10.8
+DARWIN_MIN_CRT_VERSION = -mmacosx-version-min=10.8
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-21 7:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-21 7:43 [gcc r11-10797] Darwin, libgcc : Adjust min version supported for the OS Iain D Sandoe
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).