]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Darwin: Future-proof and homogeneize detection of darwin versions
authorFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Fri, 17 Dec 2021 18:30:36 +0000 (19:30 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 16 May 2023 19:01:00 +0000 (20:01 +0100)
The current GCC branch will become 12.1.0, which will be the stable
version of GCC when the next macOS version is released. There are some
places in GCC that don’t handle darwin22 as a version, so we need to
future-proof it (gcc/config.gcc and gcc/config/darwin-driver.c). We
align that code with what Apple clang does, i.e. accept all potential
major macOS versions until 99.

This patch also homogenises the handling of darwin version numbers,
where the majority of places use darwin2*, but some used darwin2[0-9]*.
Since there never was a darwin2.x version, the two are equivalent, and
we prefer the simpler darwin2*

gcc/ChangeLog:

* config/darwin-driver.c: Make version code more future-proof.
* config.gcc: Homogeneize darwin versions.
* configure.ac: Homogeneize darwin versions.
* configure: Regenerate.

gcc/testsuite/ChangeLog:

* gcc.dg/darwin-minversion-link.c: Test darwin21.
* obj-c++.dg/cxx-ivars-3.mm: Homogeneize darwin versions.
* obj-c++.dg/objc-gc-3.mm: Homogeneize darwin versions.
* objc.dg/objc-gc-4.m: Homogeneize darwin versions.

(cherry picked from commit f18cbc1ee1f421a0dd79dc389bef9a23dd4a761d)

gcc/config.gcc
gcc/config/darwin-driver.c
gcc/configure
gcc/configure.ac
gcc/testsuite/gcc.dg/darwin-minversion-link.c
gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
gcc/testsuite/obj-c++.dg/objc-gc-3.mm
gcc/testsuite/objc.dg/objc-gc-4.m

index 5636acc227045163e5ffccfa0f791d000e2b53ab..60c058f3c636a250f1e6f8a5e617bf8d483c1461 100644 (file)
@@ -1872,7 +1872,7 @@ hppa[12]*-*-hpux11*)
                dwarf2=no
        fi
        ;;
-i[34567]86-*-darwin1[89]*)
+i[34567]86-*-darwin1[89]* | i[34567]86-*-darwin2*)
        echo "Error: 32bit target is not supported after Darwin17" 1>&2
        ;;
 i[34567]86-*-darwin*)
@@ -1882,7 +1882,7 @@ i[34567]86-*-darwin*)
        tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch t-slibgcc"
        tm_file="${tm_file} ${cpu_type}/darwin32-biarch.h"
        ;;
-x86_64-*-darwin1[89]* | x86_64-*-darwin2[01]*)
+x86_64-*-darwin1[89]* | x86_64-*-darwin2*)
        # Only 64b from now
        with_cpu=${with_cpu:-core2}
        tmake_file="${tmake_file} t-slibgcc"
index e48dd4559ebdcc1ff2c2ae5ad2a80eef6cb257eb..bf19b1cbf1eb6fedff0f7d66f7b64a01d3b4371a 100644 (file)
@@ -64,7 +64,8 @@ validate_macosx_version_min (const char *version_str)
 
   major = strtoul (version_str, &end, 10);
 
-  if (major < 10 || major > 12 ) /* macOS 10, 11, and 12 are known. */
+  /* macOS 10, 11, and 12 are known. clang accepts up to 99.  */
+  if (major < 10 || major > 99)
     return NULL;
 
   /* Skip a separating period, if there's one.  */
@@ -160,8 +161,7 @@ darwin_find_version_from_kernel (void)
 
   /* Darwin20 sees a transition to macOS 11.  In this, it seems that the
      mapping to macOS minor version is now shifted to the kernel minor
-     version - 1 (at least for the initial releases).  At this stage, we
-     don't know what macOS version will correspond to Darwin21.  */
+     version - 1 (at least for the initial releases).  */
   if (major_vers >= 20)
     {
       int minor_vers = *version_p++ - '0';
index 7218b0c331a7245b38866e7a4bf90ec4dbf6967c..327c59652e8901dfcd0878c41365fb71d0ae7edf 100755 (executable)
@@ -27016,7 +27016,7 @@ $as_echo "$as_me: WARNING: LTO for $target requires binutils >= 2.20.1, but vers
        ;;
     esac
     case $target_os in
-       darwin2[0-9]* | darwin19*)
+       darwin2* | darwin19*)
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for llvm assembler x86-pad-for-align option" >&5
 $as_echo_n "checking assembler for llvm assembler x86-pad-for-align option... " >&6; }
 if ${gcc_cv_as_mllvm_x86_pad_for_align+:} false; then :
index 49f043ed29bcc487e61d08a8b7d6f5676a405185..25a05978be95584ec6cac8f85a0ad0c0a305ee42 100644 (file)
@@ -4772,7 +4772,7 @@ foo:      nop
        ;;
     esac
     case $target_os in
-       darwin2[[0-9]]* | darwin19*)
+       darwin2* | darwin19*)
         gcc_GAS_CHECK_FEATURE([llvm assembler x86-pad-for-align option],
           gcc_cv_as_mllvm_x86_pad_for_align,,
           [-mllvm -x86-pad-for-align=false], [.text],,
index 765fb799a91820621789b10f574ac760b2e42bb9..b6ede31c985ecb22127eca7c48b0c7ddae442469 100644 (file)
@@ -15,7 +15,8 @@
 /* { dg-additional-options "-mmacosx-version-min=010.013.06 -DCHECK=101306" { target *-*-darwin17* } } */
 /* { dg-additional-options "-mmacosx-version-min=010.014.05 -DCHECK=101405" { target *-*-darwin18* } } */
 /* { dg-additional-options "-mmacosx-version-min=010.015.06 -DCHECK=101506" { target *-*-darwin19* } } */
-/* { dg-additional-options "-mmacosx-version-min=011.000.00 -DCHECK=110000" { target *-*-darwin20 } } */
+/* { dg-additional-options "-mmacosx-version-min=011.000.00 -DCHECK=110000" { target *-*-darwin20* } } */
+/* { dg-additional-options "-mmacosx-version-min=012.000.00 -DCHECK=120000" { target *-*-darwin21* } } */
 
 int
 main ()
index 07123559d72cac09192172d2663101a5cfb9af7e..27bae630ce801e20a033b289f9a7dbe9b9dcf6b4 100644 (file)
@@ -2,7 +2,7 @@
 
 // { dg-do run { target *-*-darwin* } }
 // { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
-// { dg-skip-if "Headers incompatible with 10.4 APIs" { *-*-darwin1[1-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } }
+// { dg-skip-if "Headers incompatible with 10.4 APIs" { *-*-darwin1[1-9]* *-*-darwin2* } { "-fnext-runtime" } { "" } }
 // { dg-additional-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4 -framework Foundation" }
 // This test has no equivalent or meaning for m64/ABI V2
 // { dg-xfail-run-if "No Test Avail" {  *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
index 45ffbc5553d0feeeee47d12aee26813af54ff251..18f2cbe88690a3718aa43ed3240213101dd34281 100644 (file)
@@ -3,7 +3,7 @@
 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
 
 /* { dg-do compile } */
-/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } } */
+/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-9]* *-*-darwin2* } { "-fnext-runtime" } { "" } } */
 /* { dg-options "-fobjc-gc" } */
 /* { dg-prune-output "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
 
index 8102a5a532fc6d5e23c18c9e754c620bc7f247c0..1b2d9674969f50cbd5129d0fc5756dba24b5d0e2 100644 (file)
@@ -3,7 +3,7 @@
 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
 
 /* { dg-do compile } */
-/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } } */
+/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-9]* *-*-darwin2* } { "-fnext-runtime" } { "" } } */
 /* { dg-options "-fobjc-gc" } */
 /* { dg-prune-output "cc1obj: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */