https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810
--- Comment #32 from Iain Sandoe <iains at gcc dot gnu.org> --- Author: iains Date: Thu Jun 13 18:53:05 2019 New Revision: 272260 URL: https://gcc.gnu.org/viewcvs?rev=272260&root=gcc&view=rev Log: 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 <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-06-13 Iain Sandoe <i...@sandoe.co.uk> * gcc.dg/darwin-minversion-link.c: New test. Added: trunk/gcc/testsuite/gcc.dg/darwin-minversion-link.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/darwin-driver.c trunk/gcc/testsuite/ChangeLog