]> git.ipfire.org Git - thirdparty/gcc.git/commit
Darwin, Driver - Improve processing of macosx-version-min=
authoriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Jun 2019 18:53:05 +0000 (18:53 +0000)
committeriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Jun 2019 18:53:05 +0000 (18:53 +0000)
commit228d982b3f2a03ff210299bd8d99b70d66f5b830
tree4efe29fe5d9054476d319e42c3d9b2e812932187
parent8cdc2a743d1da348538796b0b126bec1dbcd91d8
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272260 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/darwin-driver.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/darwin-minversion-link.c [new file with mode: 0644]