Darwin, Driver - Improve processing of macosx-version-min=
For PR target/63810 some improvements were made in the parsing of
the version string at the point it's used to define the built-in
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__. This is fine, but the
specs processing also uses the version, and specs version-compare
doesn't like leading zeros on components. This means that while we
succeed in processing -mmacosx-version-min=010.00002.000099 on compile
lines, it fails for any other line that uses the value as part of a spec
(in particular, link lines fail).
To fix this, we need to apply a bit of clean-up to the version that's
presented to the driver, and push that back into the command line opts.
The value can come from four places:
1. User-entered on the command line
2. User-entered as MACOSX_DEPLOYMENT_TARGET= environment var.
3. Absent those two
3a For self-hosting systems, look-up from the kernel
3b For cross-compilers, as a default supplied at configure time.
We apply the clean-up to all 4 (although it shouldn't really be needed
for the cases under 3).
We also supply a test-case that adapts to the target-version of the
system, so that the link requirements are met by the SDK in use (if you
try to link i686-darwin9 on an x86-64-darwin18 SDK, it will fail).
gcc/
2019-06-13 Iain Sandoe <iain@sandoe.co.uk>
* config/darwin-driver.c (validate_macosx_version_min): New.
(darwin_default_min_version): Cleanup and validate supplied version.
(darwin_driver_init): Likewise and push cleaned version into opts.
gcc/testsuite/
2019-06-13 Iain Sandoe <iain@sandoe.co.uk>
* gcc.dg/darwin-minversion-link.c: New test.
From-SVN: r272260
2019-06-13 20:53:05 +02:00
|
|
|
/* Test that we can handle leading-zeros on mmacosx-version-min for invocations
|
|
|
|
including linking (so that spec processing works). To make sure that any
|
|
|
|
necessary target libs are present we make this specific to the target version
|
|
|
|
being built. */
|
|
|
|
/* { dg-do link { target *-*-darwin* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.04.11 -DCHECK=1049" { target *-*-darwin8* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.05.08 -DCHECK=1058" { target *-*-darwin9* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.06.08 -DCHECK=1068" { target *-*-darwin10* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.07.05 -DCHECK=1075" { target *-*-darwin11* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.08.05 -DCHECK=1085" { target *-*-darwin12* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.09.05 -DCHECK=1095" { target *-*-darwin13* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.010.03 -DCHECK=101003" { target *-*-darwin14* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.011.06 -DCHECK=101106" { target *-*-darwin15* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.012.06 -DCHECK=101206" { target *-*-darwin16* } } */
|
|
|
|
/* { dg-additional-options "-mmacosx-version-min=010.013.06 -DCHECK=101306" { target *-*-darwin17* } } */
|
2020-07-31 22:05:28 +02:00
|
|
|
/* { 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* } } */
|
2021-12-17 19:30:36 +01:00
|
|
|
/* { 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* } } */
|
Darwin, Driver - Improve processing of macosx-version-min=
For PR target/63810 some improvements were made in the parsing of
the version string at the point it's used to define the built-in
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__. This is fine, but the
specs processing also uses the version, and specs version-compare
doesn't like leading zeros on components. This means that while we
succeed in processing -mmacosx-version-min=010.00002.000099 on compile
lines, it fails for any other line that uses the value as part of a spec
(in particular, link lines fail).
To fix this, we need to apply a bit of clean-up to the version that's
presented to the driver, and push that back into the command line opts.
The value can come from four places:
1. User-entered on the command line
2. User-entered as MACOSX_DEPLOYMENT_TARGET= environment var.
3. Absent those two
3a For self-hosting systems, look-up from the kernel
3b For cross-compilers, as a default supplied at configure time.
We apply the clean-up to all 4 (although it shouldn't really be needed
for the cases under 3).
We also supply a test-case that adapts to the target-version of the
system, so that the link requirements are met by the SDK in use (if you
try to link i686-darwin9 on an x86-64-darwin18 SDK, it will fail).
gcc/
2019-06-13 Iain Sandoe <iain@sandoe.co.uk>
* config/darwin-driver.c (validate_macosx_version_min): New.
(darwin_default_min_version): Cleanup and validate supplied version.
(darwin_driver_init): Likewise and push cleaned version into opts.
gcc/testsuite/
2019-06-13 Iain Sandoe <iain@sandoe.co.uk>
* gcc.dg/darwin-minversion-link.c: New test.
From-SVN: r272260
2019-06-13 20:53:05 +02:00
|
|
|
|
|
|
|
int
|
|
|
|
main ()
|
|
|
|
{
|
|
|
|
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != CHECK
|
|
|
|
fail me;
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|