Closed fxcoudert closed 2 years ago
Yes, I suppose we could (will roll it into the patches going forward), that seems relatively harmless.
The more complicated issue is the mapping between darwinXX.YY and macOS version (and thus automatically determining macosx-version-min), where the comment came back to my query that it might, ultimately, need to be a lookup table.
Suggested patch for future-proofing macOS versions. (The information received is that while no formal guarantee can be made about future version naming, there is at this stage no change expected to the new scheme.)
Apple's clang accepts macOS major version up to 99, so we should mimic that.
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 5516e6d848e..53ee7f377cf 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1873,7 +1873,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[0-9]*)
# 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-c.c b/gcc/config/darwin-c.c
index 62d28fcea50..21f709d3869 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -691,7 +691,7 @@ macosx_version_as_macro (void)
if (!version_array)
goto fail;
- if (version_array[MAJOR] < 10 || version_array[MAJOR] > 12)
+ if (version_array[MAJOR] < 10 || version_array[MAJOR] > 99)
goto fail;
if (version_array[MAJOR] == 10 && version_array[MINOR] < 10)
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 6412e41f621..bdcae261a7d 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/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/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 4cdda6f5e33..ffa578c083b 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -171,7 +171,7 @@ proc set_ld_library_path_env_vars { } {
}
if { [istarget *-*-darwin*] } {
if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*]
- || [istarget *-*-darwin20*] } {
+ || [istarget *-*-darwin2*] } {
# Either we are not using DYLD_LIBRARY_PATH or we're on a version of the
# OS for which it is not passed through system exes.
if [info exists env(DYLD_LIBRARY_PATH)] {
And an unrelated patch, for a test that cannot pass on aarch64-apple-darwin:
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
index 5ec05587dba..19c4aebbc7d 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
@@ -9,7 +9,7 @@
/* arm_hf_eabi: Variadic funcs use Base AAPCS. Normal funcs use VFP variant.
avr: Variadic funcs don't pass arguments in registers, while normal funcs
do. */
-/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { csky*-*-* avr-*-* riscv*-*-* or1k*-*-* msp430-*-* amdgcn-*-* pru-*-* } } } */
+/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { csky*-*-* avr-*-* riscv*-*-* or1k*-*-* msp430-*-* amdgcn-*-* pru-*-* aarch64-apple-darwin* } } } */
/* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { nds32*-*-* } { v850*-*-* } } */
/* { dg-require-effective-target untyped_assembly } */
I think this is generally OK
Would you be able to split the patches into
As a general comment, there was never a macOS corresponding to darwin2, so I think for darwin2[0-9] .. it's fine to write darwin2*.
(I think we can get these and a few other cleanup patches into the next rebase - coming weekend, and hopefully without so many hassles as the last one)
Remaining patches for this branch:
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
index 5ec05587dba..19c4aebbc7d 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c
@@ -9,7 +9,7 @@
/* arm_hf_eabi: Variadic funcs use Base AAPCS. Normal funcs use VFP variant.
avr: Variadic funcs don't pass arguments in registers, while normal funcs
do. */
-/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { csky*-*-* avr-*-* riscv*-*-* or1k*-*-* msp430-*-* amdgcn-*-* pru-*-* } } } */
+/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { csky*-*-* avr-*-* riscv*-*-* or1k*-*-* msp430-*-* amdgcn-*-* pru-*-* aarch64-apple-darwin* } } } */
/* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { nds32*-*-* } { v850*-*-* } } */
/* { dg-require-effective-target untyped_assembly } */
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 4cdda6f5e33..ffa578c083b 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -171,7 +171,7 @@ proc set_ld_library_path_env_vars { } {
}
if { [istarget *-*-darwin*] } {
if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*]
- || [istarget *-*-darwin20*] } {
+ || [istarget *-*-darwin2*] } {
# Either we are not using DYLD_LIBRARY_PATH or we're on a version of the
# OS for which it is not passed through system exes.
if [info exists env(DYLD_LIBRARY_PATH)] {
thanks, I'll add this in for the next cycle.
Committed upstream + locally.
This commit: https://github.com/iains/gcc-darwin-arm64/commit/20f61faaed3b335d792e38892d826054d2ac9f15 means major versions higher than 12 are not valid as argument to
-mmacosx-version-min=
. This mean it will have to be patched again for the next major version.clang
accepts all major versions up to 99. Could we do the same?