Skip to content

Commit 11b9675

Browse files
saagarjhaiains
authored andcommitted
Darwin, config: Amend for Darwin 21 / macOS 12.
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.
1 parent aeb10f8 commit 11b9675

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

gcc/config.gcc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,9 @@ case ${target} in
681681
*-*-darwin[4-9]* | *-*-darwin1[0-9]*)
682682
macos_min=`expr $darwin_maj - 4`
683683
;;
684-
*-*-darwin20*)
685-
# Darwin 20 corresponds to macOS 11.
686-
macos_maj=11
684+
*-*-darwin2*)
685+
# Darwin 20 corresponds to macOS 11, Darwin 21 to macOS 12.
686+
macos_maj=`expr $darwin_maj - 9`
687687
def_ld64=609.0
688688
;;
689689
*-*-darwin)

gcc/config/darwin-c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ macosx_version_as_macro (void)
691691
if (!version_array)
692692
goto fail;
693693

694-
if (version_array[MAJOR] < 10 || version_array[MAJOR] > 11)
694+
if (version_array[MAJOR] < 10 || version_array[MAJOR] > 12)
695695
goto fail;
696696

697697
if (version_array[MAJOR] == 10 && version_array[MINOR] < 10)

gcc/config/darwin-driver.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ validate_macosx_version_min (const char *version_str)
6464

6565
major = strtoul (version_str, &end, 10);
6666

67-
if (major < 10 || major > 11 ) /* MacOS 10 and 11 are known. */
67+
if (major < 10 || major > 12 ) /* macOS 10, 11, and 12 are known. */
6868
return NULL;
6969

7070
/* Skip a separating period, if there's one. */
7171
version_str = end + ((*end == '.') ? 1 : 0);
7272

73-
if (major == 11 && *end != '\0' && !ISDIGIT (version_str[0]))
74-
/* For MacOS 11, we allow just the major number, but if the minor is
73+
if (major > 10 && *end != '\0' && !ISDIGIT (version_str[0]))
74+
/* For macOS 11+, we allow just the major number, but if the minor is
7575
there it must be numeric. */
7676
return NULL;
77-
else if (major == 11 && *end == '\0')
77+
else if (major > 10 && *end == '\0')
7878
/* We will rewrite 11 => 11.0.0. */
7979
need_rewrite = true;
8080
else if (major == 10 && (*end == '\0' || !ISDIGIT (version_str[0])))
@@ -172,7 +172,7 @@ darwin_find_version_from_kernel (void)
172172
if (minor_vers > 0)
173173
minor_vers -= 1; /* Kernel 20.3 => macOS 11.2. */
174174
/* It's not yet clear whether patch level will be considered. */
175-
asprintf (&new_flag, "11.%02d.00", minor_vers);
175+
asprintf (&new_flag, "%d.%02d.00", major_vers - 9, minor_vers);
176176
}
177177
else if (major_vers - 4 <= 4)
178178
/* On 10.4 and earlier, the old linker is used which does not

0 commit comments

Comments
 (0)