Skip to content

Commit 432eb1f

Browse files
author
Steve Pfister
committed
Add workaround from dotnet#97856 to use classic linker on macos
1 parent fc5e3ef commit 432eb1f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,19 @@ The .NET Foundation licenses this file to you under the MIT license.
230230
<LinkerArg Include="-Wl,--eh-frame-hdr" Condition="'$(_IsApplePlatform)' != 'true'" />
231231
</ItemGroup>
232232

233+
<Exec Command="xcodebuild -version" Condition="'$(_IsApplePlatform)' == 'true'" IgnoreExitCode="true" StandardOutputImportance="Low" ConsoleToMSBuild="true">
234+
<Output TaskParameter="ExitCode" PropertyName="_XcodeVersionStringExitCode" />
235+
<Output TaskParameter="ConsoleOutput" PropertyName="_XcodeVersionString" />
236+
</Exec>
237+
238+
<PropertyGroup Condition="('$(_XcodeVersionStringExitCode)' == '0' or '$(_XcodeVersionStringExitCode)' == '1') and '$(_XcodeVersionString)' != ''">
239+
<_XcodeVersion>$([System.Text.RegularExpressions.Regex]::Match($(_XcodeVersionString), '[1-9]\d*'))</_XcodeVersion>
240+
</PropertyGroup>
241+
242+
<ItemGroup Condition="'$(UseLdClassicXCodeLinker)' != 'false' and '$(_IsApplePlatform)' == 'true'">
243+
<CustomLinkerArg Condition="'$(_XcodeVersion)' &gt;= '15'" Include="-ld_classic" />
244+
</ItemGroup>
245+
233246
<PropertyGroup>
234247
<_CommandProbe>command -v</_CommandProbe>
235248
<_CommandProbe Condition="$([MSBuild]::IsOSPlatform('Windows'))">where /Q</_CommandProbe>

src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@
7272
<Output TaskParameter="ConsoleOutput" PropertyName="_CC_LDFLAGS" />
7373
</Exec>
7474

75+
<Exec Command="xcodebuild -version" Condition="'$(_IsApplePlatform)' == 'true'" IgnoreExitCode="true" StandardOutputImportance="Low" ConsoleToMSBuild="true">
76+
<Output TaskParameter="ExitCode" PropertyName="_XcodeVersionStringExitCode" />
77+
<Output TaskParameter="ConsoleOutput" PropertyName="_XcodeVersionString" />
78+
</Exec>
79+
80+
<PropertyGroup Condition="('$(_XcodeVersionStringExitCode)' == '0' or '$(_XcodeVersionStringExitCode)' == '1') and '$(_XcodeVersionString)' != ''">
81+
<_XcodeVersion>$([System.Text.RegularExpressions.Regex]::Match($(_XcodeVersionString), '[1-9]\d*'))</_XcodeVersion>
82+
</PropertyGroup>
83+
84+
<ItemGroup Condition="'$(NativeAotSupported)' == 'true' and '$(_IsApplePlatform)' == 'true'">
85+
<CustomLinkerArg Condition="'$(_XcodeVersion)' &gt;= '15'" Include="-ld_classic" />
86+
</ItemGroup>
87+
7588
<PropertyGroup>
7689
<CppLinker>$(_CC_LDFLAGS.SubString(0, $(_CC_LDFLAGS.IndexOf(';'))))</CppLinker>
7790
<_LDFLAGS>$(_CC_LDFLAGS.SubString($([MSBuild]::Add($(_CC_LDFLAGS.IndexOf(';')), 1))))</_LDFLAGS>

0 commit comments

Comments
 (0)