https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810

--- Comment #33 from Iain Sandoe <iains at gcc dot gnu.org> ---
Author: iains
Date: Fri Aug  2 14:54:57 2019
New Revision: 274017

URL: https://gcc.gnu.org/viewcvs?rev=274017&root=gcc&view=rev
Log:
darwin, backport driver fixes.

272260,r272479 - 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-08-02  Iain Sandoe  <i...@sandoe.co.uk>

        Backport from mainline
        2019-06-19  Iain Sandoe  <i...@sandoe.co.uk>

        * config/darwin-driver.c (darwin_driver_init): Fix off-by-one errors
        in computing the number of options to be moved.

        Backport from mainline
        2019-06-13  Iain Sandoe  <i...@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-08-02  Iain Sandoe  <i...@sandoe.co.uk>

        2019-06-13  Iain Sandoe  <i...@sandoe.co.uk>

        * gcc.dg/darwin-minversion-link.c: New test.


Added:
    branches/gcc-9-branch/gcc/testsuite/gcc.dg/darwin-minversion-link.c
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/config/darwin-driver.c
    branches/gcc-9-branch/gcc/testsuite/ChangeLog

Reply via email to