Mac OS X SDK: 10.6
We want to configure GCC so that OS X 10.6 is the default target. For this, we changed DARWIN_MINVERSION_SPEC to be "10.6". This seemed to work - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is 1060. However, we later then realized that calling gcc with -mmacosx-version-min=10.6 gave a different behaviour. For example, in the latter case, ld is called with -no_compact_unwind. In other words, changing DARWIN_MINVERSION_SPEC / %(darwin_minversion) to say 10.6 causes GCC to run with a split personality, where some parts thinks it's 10.4 and others thinks it's 10.6.
In order to solve this, either a lot of spec logics needs to be changed, or the -mmacosx-version-min argument needs to be "faked". This is actually done when the environment variable MACOSX_DEPLOYMENT_TARGET is found - but not when cross compiling. Any good reason for this?
Also, it seems to me that DARWIN_MINVERSION_SPEC / %(darwin_minversion) is not that useful, when most of the specs are checking the -mmacosx-version-min argument anyway.
The patch from gkeating (https://gcc.gnu.org/ml/gcc-patches/2007-02/msg01484.html) had the explicit goal of "fix or avoid a bunch of bugs where one part or another of the toolchain differed from the compiler in the minimum system version to be targetted.", but this is exactly the problem we are seeing here, thus I believe some additional work is required.
Created attachment 34933 [details]
Activate parts of darwin_default_min_version() even when not cross
The attached patch activates darwin_default_min_version() even when CROSS_DIRECTORY_STRUCTURE, and if MACOSX_DEPLOYMENT_TARGET is set, it falls back to a hardcoded 10.6 default. This solves our particular problem, but some additional work would be required to make e generic solution. For example, perhaps the fallback should be based on expanding %(darwin_minversion), or perhaps the default target kan be fetched from the SDK file tree?
Could you please attach a testcase that fails without your patch, and passes after your patch is applied? Marking as WAITING until there is a clearer recipe to reproduce this bug.
(In reply to Eric Gallager from comment #2)
> Could you please attach a testcase that fails without your patch, and passes
> after your patch is applied? Marking as WAITING until there is a clearer
> recipe to reproduce this bug.
(also you should send your patch from comment #1 to the gcc-patches mailing list, too; it's liable to get lost here)
Closing due to lack of a testcase; feel free to reopen if you have one, or if you send the patch to the gcc-patches mailing list