https://gcc.gnu.org/g:aa5d3209319b654ea08de3a4e41649f676949ff6

commit r14-12690-gaa5d3209319b654ea08de3a4e41649f676949ff6
Author: Francois-Xavier Coudert <[email protected]>
Date:   Mon Jul 14 12:14:00 2025 +0200

    Darwin: account for macOS 26
    
    darwin25 will be named macOS 26 (codename Tahoe). This is a change from
    darwin24, which was macOS 15. We need to adapt the driver to this new
    numbering scheme.
    
    2025-07-14  François-Xavier Coudert  <[email protected]>
    
    gcc/ChangeLog:
    
            PR target/120645
            * config/darwin-driver.cc: Account for latest macOS numbering
            scheme.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.dg/darwin-minversion-link.c: Account for macOS 26.
    
    (cherry picked from commit cc4f3397331f6ecd5e775cf963c65face0145f3f)

Diff:
---
 gcc/config/darwin-driver.cc                   | 22 ++++++++++++----------
 gcc/testsuite/gcc.dg/darwin-minversion-link.c |  2 ++
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/gcc/config/darwin-driver.cc b/gcc/config/darwin-driver.cc
index eabe9bc970d1..ece2cce491a2 100644
--- a/gcc/config/darwin-driver.cc
+++ b/gcc/config/darwin-driver.cc
@@ -64,7 +64,8 @@ validate_macosx_version_min (const char *version_str)
 
   major = strtoul (version_str, &end, 10);
 
-  /* macOS 10, 11, and 12 are known. clang accepts up to 99.  */
+  /* macOS 10, 11, 12, 13, 14, 15 and 26 are known.
+     clang accepts up to 99.  */
   if (major < 10 || major > 99)
     return NULL;
 
@@ -159,15 +160,16 @@ darwin_find_version_from_kernel (void)
   if (*version_p++ != '.')
     goto parse_failed;
 
-  /* Darwin20 sees a transition to macOS 11.  In this, it seems that the
-     mapping to macOS minor version and patch level is now always 0, 0
-     (at least for macOS 11 and 12).  */
-  if (major_vers >= 20)
-    {
-      /* Apple clang doesn't include the minor version or the patch level
-        in the object file, nor does it pass it to ld  */
-      asprintf (&new_flag, "%d.00.00", major_vers - 9);
-    }
+  /* Darwin25 saw a transition to macOS 26.  */
+  if (major_vers >= 25)
+    /* Apple clang doesn't include the minor version or the patch level
+       in the object file, nor does it pass it to ld  */
+    asprintf (&new_flag, "%d.00.00", major_vers + 1);
+  /* Darwin20 saw a transition to macOS 11.  */
+  else if (major_vers >= 20)
+    /* Apple clang doesn't include the minor version or the patch level
+       in the object file, nor does it pass it to ld  */
+    asprintf (&new_flag, "%d.00.00", major_vers - 9);
   else if (major_vers - 4 <= 4)
     /* On 10.4 and earlier, the old linker is used which does not
        support three-component system versions.
diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-link.c 
b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
index a835e9d4648a..55f7c7ea8374 100644
--- a/gcc/testsuite/gcc.dg/darwin-minversion-link.c
+++ b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
@@ -19,6 +19,8 @@
 /* { dg-additional-options "-mmacosx-version-min=012.000.00 -DCHECK=120000" { 
target *-*-darwin21* } } */
 /* { dg-additional-options "-mmacosx-version-min=013.000.00 -DCHECK=130000" { 
target *-*-darwin22* } } */
 /* { dg-additional-options "-mmacosx-version-min=014.000.00 -DCHECK=140000" { 
target *-*-darwin23* } } */
+/* { dg-additional-options "-mmacosx-version-min=015.000.00 -DCHECK=150000" { 
target *-*-darwin24* } } */
+/* { dg-additional-options "-mmacosx-version-min=026.000.00 -DCHECK=260000" { 
target *-*-darwin25* } } */
 
 int
 main ()

Reply via email to