Created by: v-jizhang
Summary:
With the 11.4.1 Xcode toolchain, when warnings are treated as fatal (which some apps do), ld errors out on both the platform_version and sdk_version being set. https://reviews.llvm.org/rG25ce33a6e4f3b13732c0f851e68390dc2acb9123 shows that the platform is derived, and set after version 520.
We can always expect the Xcode toolchain to contain ld, so if we get the version, for versions above 520, we can stop setting the sdk_version. I haven't been able to find when it became an error.
ld: warning: -sdk_version and -platform_version are not compatible, ignoring -sdk_version
ld: fatal warning(s) induced error (-fatal_warnings)
LD versions:
chatatap@chatatap-mac ~/fbsource> /Applications/Xcode_11.4.1_fb.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -v
@(#)PROGRAM:ld PROJECT:ld64-556.6
BUILD 13:10:29 Apr 7 2020
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 11.0.3, (clang-1103.0.32.59) (static support for 26, runtime is 26)
TAPI support using: Apple TAPI version 11.0.0 (tapi-1100.0.11)
chatatap@chatatap-mac ~/fbsource> /Applications/Xcode_11.3.1_fb.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -v
@(#)PROGRAM:ld PROJECT:ld64-530
BUILD 18:57:17 Dec 13 2019
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 11.0.0, (clang-1100.0.33.17) (static support for 23, runtime is 23)
TAPI support using: Apple TAPI version 11.0.0 (tapi-1100.0.11)
If we cannot get the ld version for whatever reason, we fall back to the default behavior of setting the sdk_version.
Reviewed By: milend
shipit-source-id: 6d3181c705c14c141ae902e7f414c870a9a26324