When bootstrapping current trunk on macOS 14.0 beta 3 with Xcode 15 beta 3, every single link test in the testsuite fails with excess errors since ld now warns -macosx_version_min has been renamed to -macos_version_min I'm currently working on patches to prune that message in the testsuite, plus large additional patches to the gm2 testsuite to perform the pruning at all. Ultimately, this should be handled in the driver, though: the warning is new in Xcode 15 beta 3 (beta 2 didn't have it). However, ld accepts the new form back to at least Xcode 13 (haven't looked further yet), and it's the only one documented in ld(1).
OK. (I do not have enough hardware to install 14 or xc15 at present). I guess we just add a configuration test for it and then make the link line dependent; will have a go on D21+XC14.3
> --- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> --- > OK. (I do not have enough hardware to install 14 or xc15 at present). You don't depend on macOS 14 here, fortunately: xc 15 still supports macOS 13.4+. I'm running in qemu btw., the only virtualization solution that does support 13 and 14 at the moment. > I guess we just add a configuration test for it and then make the link line > dependent; will have a go on D21+XC14.3 I suspect so: older versions like xc 8 certainly don't support the new form.
actually, we already have a config test for -platform_version, which is what clang passes to ld. First, I'll take a look at enabling that (in which case the mmacosx_version_min is not needed). I take it that clang -cc1as does not warn for -mmacosx-version-min= ?
> --- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> --- > actually, we already have a config test for -platform_version, which is what > clang passes to ld. First, I'll take a look at enabling that (in which case > the mmacosx_version_min is not needed). That would be even easier indeed. > I take it that clang -cc1as does not warn for -mmacosx-version-min= ? Right: the HAVE_AS_MMACOSX_VERSION_MIN_OPTION test succeeds.
Created attachment 55523 [details] Patch for testing I tested this (by bootstrapping GCC with it) on x86_64 darwin21 with Xcode 14.3. FWIW; The reason I had not done this sooner, is that I do not have a sensible way to look up the SDK version at the moment (the second parameter), but AFAIK 0.0 is allowed as a "don't know", so we can improve on this at a later time Here, I will test on some earlier Darwin versions - but would welcome confirmation that it fixes the XC15 issue. ----- ``` COLLECT_GCC_OPTIONS='-B' 'gcc' '-o' 'hc' '-v' '-save-temps' '-mmacosx-version-min=12.0.0' '-nodefaultexport' '-mtune=core2' '-dumpdir' 'hc.' gcc/collect2 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/ -dynamic -arch x86_64 -platform_version macos 12.0.0 0.0 -o hc -Lgcc hc-hello.o -v -lemutls_w -lgcc -lSystem -no_compact_unwind collect2 version 14.0.0 20230707 (experimental) [remotes/home/master revision r14-2384-gbb3b9c1c3ba8] gcc/collect-ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/ -dynamic -arch x86_64 -platform_version macos 12.0.0 0.0 -o hc -Lgcc hc-hello.o -v -lemutls_w -lgcc -lSystem -no_compact_unwind @(#)PROGRAM:ld PROJECT:ld64-857.1 ```
> --- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> --- > Here, I will test on some earlier Darwin versions - but would welcome > confirmation that it fixes the XC15 issue. I've done that now and could successfully bootstrap on macOS 14.0 beta 3 with Xcode 15 beta 4. Thanks for the patch, especially since my patch series to consistently prune the ld warning provded to be a can of worms. I needed one patch to link m2/boot-bin/mklink with -static-libstdc++ (to be submitted shortly). However, there's an enormous number of issues compared to macOS 14.0 beta 2/Xcode 15 beta 2, in particular all (?) EH-related execution tests failing, and all gfortran tests failing due to ld warnings about duplicate libraries (will submit a PR for that).
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: https://gcc.gnu.org/g:032b5da1fc781bd3c23d9caa72fb09439e7f6f3a commit r14-2506-g032b5da1fc781bd3c23d9caa72fb09439e7f6f3a Author: Iain Sandoe <iain@sandoe.co.uk> Date: Thu Jul 13 07:36:51 2023 +0100 Darwin: Use -platform_version when available [PR110624]. Later versions of the static linker support a more flexible flag to describe the OS, OS version and SDK used to build the code. This replaces the functionality of '-mmacosx_version_min' (which is now deprecated, leading to the diagnostic described in the PR). We now use the platform_version flag when available which avoids the diagnostic. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR target/110624 gcc/ChangeLog: * config/darwin.h (DARWIN_PLATFORM_ID): New. (LINK_COMMAND_A): Use DARWIN_PLATFORM_ID to pass OS, OS version and SDK data to the static linker.
so fixed by using the platform_version change. If anyone runs into a problem because they have makefiles/etc that build stand-alone ld lines, I guess they will have to fix them anyway (nothing GCC can do about that).
The releases/gcc-13 branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: https://gcc.gnu.org/g:4adf49a436429010ba928d4dc262625298e0d21a commit r13-7587-g4adf49a436429010ba928d4dc262625298e0d21a Author: Iain Sandoe <iain@sandoe.co.uk> Date: Thu Jul 13 07:36:51 2023 +0100 Darwin: Use -platform_version when available [PR110624]. Later versions of the static linker support a more flexible flag to describe the OS, OS version and SDK used to build the code. This replaces the functionality of '-mmacosx_version_min' (which is now deprecated, leading to the diagnostic described in the PR). We now use the platform_version flag when available which avoids the diagnostic. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR target/110624 gcc/ChangeLog: * config/darwin.h (DARWIN_PLATFORM_ID): New. (LINK_COMMAND_A): Use DARWIN_PLATFORM_ID to pass OS, OS version and SDK data to the static linker. (cherry picked from commit 032b5da1fc781bd3c23d9caa72fb09439e7f6f3a)
The releases/gcc-12 branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: https://gcc.gnu.org/g:a17f5a03e93d2cc6fd40cef6ab3930ba019f804a commit r12-10310-ga17f5a03e93d2cc6fd40cef6ab3930ba019f804a Author: Iain Sandoe <iain@sandoe.co.uk> Date: Thu Jul 13 07:36:51 2023 +0100 Darwin: Use -platform_version when available [PR110624]. Later versions of the static linker support a more flexible flag to describe the OS, OS version and SDK used to build the code. This replaces the functionality of '-mmacosx_version_min' (which is now deprecated, leading to the diagnostic described in the PR). We now use the platform_version flag when available which avoids the diagnostic. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR target/110624 gcc/ChangeLog: * config/darwin.h (DARWIN_PLATFORM_ID): New. (LINK_COMMAND_A): Use DARWIN_PLATFORM_ID to pass OS, OS version and SDK data to the static linker. (cherry picked from commit 032b5da1fc781bd3c23d9caa72fb09439e7f6f3a)