]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Darwin, Driver] Fix driver crashes with valid command line input.
authorIain Sandoe <iain@sandoe.co.uk>
Wed, 4 Sep 2019 19:17:41 +0000 (19:17 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Wed, 4 Sep 2019 19:17:41 +0000 (19:17 +0000)
commitc5a0440d8fb19f5c8857fd589675cd8eb9b012cc
tree1b171ba542bfca22b3dd73ae6ce2b72ebfabc1f1
parent32426744fe6fbdf53a9295f0ac48bb3bf341ffa3
[Darwin, Driver] Fix driver crashes with valid command line input.

Backport 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-09-04  Iain Sandoe  <iain@sandoe.co.uk>

Backport from mainline
2019-06-19  Iain Sandoe  <iain@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  <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-09-04  Iain Sandoe  <iain@sandoe.co.uk>

Backport from mainline.
2019-06-13  Iain Sandoe  <iain@sandoe.co.uk>

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

From-SVN: r275382
gcc/ChangeLog
gcc/config/darwin-driver.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/darwin-minversion-link.c [new file with mode: 0644]