]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Darwin, config: Amend for Darwin 21 / macOS 12.
authorSaagar Jha <saagar@saagarjha.com>
Tue, 15 Jun 2021 11:08:23 +0000 (04:08 -0700)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 29 May 2022 19:03:09 +0000 (20:03 +0100)
It seems that the OS major version is now tracking the kernel
major version - 9.  Minor version has been set to kerne
min - 1.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
Signed-off-by: Saagar Jha <saagar@saagarjha.com>
gcc/ChangeLog:

* config.gcc: Adjust for Darwin21.
* config/darwin-c.c (macosx_version_as_macro): Likewise.
* config/darwin-driver.c (validate_macosx_version_min):
Likewise.
(darwin_find_version_from_kernel): Likewise.

(cherry picked from commit 11b967577483e51f97d540e9c2c9d1ea76da8122)

gcc/config.gcc
gcc/config/darwin-c.c
gcc/config/darwin-driver.c

index 6fcdd771d4c32604685ebc5da3e20260fe6da2ad..61b1ae685b8b1f806dff87fa44f71ae82408fb9a 100644 (file)
@@ -691,9 +691,9 @@ case ${target} in
       *-*-darwin[4-9]* | *-*-darwin1[0-9]*)
         macos_min=`expr $darwin_maj - 4`
         ;;
-      *-*-darwin20*)
-        # Darwin 20 corresponds to macOS 11.
-        macos_maj=11
+      *-*-darwin2*)
+        # Darwin 20 corresponds to macOS 11, Darwin 21 to macOS 12.
+        macos_maj=`expr $darwin_maj - 9`
         def_ld64=609.0
         ;;
       *-*-darwin)
index 961723057117193b1d5503d6f3bb9de9363a4ca2..3c2afe5652225de5a3f05d57dfd9160cc83e2cfb 100644 (file)
@@ -691,7 +691,7 @@ macosx_version_as_macro (void)
   if (!version_array)
     goto fail;
 
-  if (version_array[MAJOR] < 10 || version_array[MAJOR] > 11)
+  if (version_array[MAJOR] < 10 || version_array[MAJOR] > 12)
     goto fail;
 
   if (version_array[MAJOR] == 10 && version_array[MINOR] < 10)
index f00d5a02d1d01bdf0570fa60c090a7b4700d95c8..35f925aef8661de4a5e6113b20c02b586d7401e4 100644 (file)
@@ -64,17 +64,17 @@ validate_macosx_version_min (const char *version_str)
 
   major = strtoul (version_str, &end, 10);
 
-  if (major < 10 || major > 11 ) /* MacOS 10 and 11 are known. */
+  if (major < 10 || major > 12 ) /* macOS 10, 11, and 12 are known. */
     return NULL;
 
   /* Skip a separating period, if there's one.  */
   version_str = end + ((*end == '.') ? 1 : 0);
 
-  if (major == 11 && *end != '\0' && !ISDIGIT (version_str[0]))
-     /* For MacOS 11, we allow just the major number, but if the minor is
+  if (major > 10 && *end != '\0' && !ISDIGIT (version_str[0]))
+     /* For macOS 11+, we allow just the major number, but if the minor is
        there it must be numeric.  */
     return NULL;
-  else if (major == 11 && *end == '\0')
+  else if (major > 10 && *end == '\0')
     /* We will rewrite 11 =>  11.0.0.  */
     need_rewrite = true;
   else if (major == 10 && (*end == '\0' || !ISDIGIT (version_str[0])))
@@ -172,7 +172,7 @@ darwin_find_version_from_kernel (void)
       if (minor_vers > 0)
        minor_vers -= 1; /* Kernel 20.3 => macOS 11.2.  */
       /* It's not yet clear whether patch level will be considered.  */
-      asprintf (&new_flag, "11.%02d.00", minor_vers);
+      asprintf (&new_flag, "%d.%02d.00", major_vers - 9, minor_vers);
     }
   else if (major_vers - 4 <= 4)
     /* On 10.4 and earlier, the old linker is used which does not