public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Future-proof and homogenise handling of darwin versions
@ 2021-12-17 22:23 FX
  2021-12-17 23:18 ` Iain Sandoe
  0 siblings, 1 reply; 3+ messages in thread
From: FX @ 2021-12-17 22:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: Iain Sandoe

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

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*

Bootstrapped and regtested on x86_64-apple-darwin21.
OK to commit?

FX


[-- Attachment #2: darwin.patch --]
[-- Type: application/octet-stream, Size: 6915 bytes --]

commit 5dc5ccde728279af5621ea4d513450822a126b03
Author: François-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date:   2021-12-17 19:30:36 +0100

    Future-proof and homogeneize detection of darwin versions
    
    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.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index c8824367b13..c8c0ef9aa05 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1847,7 +1847,7 @@ hppa[12]*-*-hpux11*)
 		dwarf2=no
 	fi
 	;;
-i[34567]86-*-darwin1[89]* | i[34567]86-*-darwin2[0-9]*)
+i[34567]86-*-darwin1[89]* | i[34567]86-*-darwin2*)
 	echo "Error: 32bit target is not supported after Darwin17" 1>&2
 	;;
 i[34567]86-*-darwin*)
@@ -1857,7 +1857,7 @@ i[34567]86-*-darwin*)
 	tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch t-slibgcc"
 	tm_file="${cpu_type}/darwin32-biarch.h ${tm_file} "
 	;;
-x86_64-*-darwin1[89]* | x86_64-*-darwin2[01]*)
+x86_64-*-darwin1[89]* | x86_64-*-darwin2*)
 	# Only 64b from now
 	tm_defines="${tm_defines} TARGET_64BIT_DEFAULT=(OPTION_MASK_ISA_64BIT|OPTION_MASK_ABI_64)"
 	tm_defines="${tm_defines} TARGET_BI_ARCH=0"
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 688fe8fabc0..e459a72f907 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -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';
diff --git a/gcc/configure b/gcc/configure
index 5470987b62f..992a9d70092 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -26947,7 +26947,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 :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 2b4914b6ec1..0db9c4cb027 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4692,7 +4692,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],,
diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-link.c b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
index 765fb799a91..b6ede31c985 100644
--- a/gcc/testsuite/gcc.dg/darwin-minversion-link.c
+++ b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
@@ -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 ()
diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
index 07123559d72..27bae630ce8 100644
--- a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
+++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
@@ -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" } { "" } }
diff --git a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
index 45ffbc5553d..18f2cbe8869 100644
--- a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
+++ b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
@@ -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'" } */
 
diff --git a/gcc/testsuite/objc.dg/objc-gc-4.m b/gcc/testsuite/objc.dg/objc-gc-4.m
index 8102a5a532f..1b2d9674969 100644
--- a/gcc/testsuite/objc.dg/objc-gc-4.m
+++ b/gcc/testsuite/objc.dg/objc-gc-4.m
@@ -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'" } */
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Future-proof and homogenise handling of darwin versions
  2021-12-17 22:23 [patch] Future-proof and homogenise handling of darwin versions FX
@ 2021-12-17 23:18 ` Iain Sandoe
  2021-12-18 12:19   ` FX
  0 siblings, 1 reply; 3+ messages in thread
From: Iain Sandoe @ 2021-12-17 23:18 UTC (permalink / raw)
  To: FX; +Cc: gcc-patches

Hi FX,

thanks for the patch

> On 17 Dec 2021, at 22:23, FX <fxcoudert@gmail.com> wrote:
> 
> 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*
> 
> Bootstrapped and regtested on x86_64-apple-darwin21.
> OK to commit?

Yes, but please put this ^^ explanation into the git commit log, and prepend the title line with Darwin:

the latter helps locate things that might need backporting, and the former means that we have an easy-to-find rationale for the patch (one of the nicer things about this new system!).

thanks
Iain

> 
> FX
> 
> <darwin.patch>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Future-proof and homogenise handling of darwin versions
  2021-12-17 23:18 ` Iain Sandoe
@ 2021-12-18 12:19   ` FX
  0 siblings, 0 replies; 3+ messages in thread
From: FX @ 2021-12-18 12:19 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: gcc-patches

> Yes, but please put this ^^ explanation into the git commit log, and prepend the title line with Darwin:

Thanks, committed.

FX

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-18 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 22:23 [patch] Future-proof and homogenise handling of darwin versions FX
2021-12-17 23:18 ` Iain Sandoe
2021-12-18 12:19   ` FX

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).