Skip to content

Commit bb540a8

Browse files
VSadovjkotas
andauthored
[NativeAOT][8.0] Use ld_classic in ILC build and in build integration (#97856)
* use ld_classic in ILC build and in build integration * PR feedback * Maybe fix the build for non-apple * Update src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets PR feedback Co-authored-by: Jan Kotas <jkotas@microsoft.com> --------- Co-authored-by: Jan Kotas <jkotas@microsoft.com>
1 parent dedae5e commit bb540a8

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

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

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

169+
<Exec Command="xcodebuild -version" Condition="'$(_IsApplePlatform)' == 'true'" IgnoreExitCode="true" StandardOutputImportance="Low" ConsoleToMSBuild="true">
170+
<Output TaskParameter="ExitCode" PropertyName="_XcodeVersionStringExitCode" />
171+
<Output TaskParameter="ConsoleOutput" PropertyName="_XcodeVersionString" />
172+
</Exec>
173+
174+
<PropertyGroup Condition="('$(_XcodeVersionStringExitCode)' == '0' or '$(_XcodeVersionStringExitCode)' == '1') and '$(_XcodeVersionString)' != ''">
175+
<_XcodeVersion>$([System.Text.RegularExpressions.Regex]::Match($(_XcodeVersionString), '[1-9]\d*'))</_XcodeVersion>
176+
</PropertyGroup>
177+
178+
<ItemGroup Condition="'$(UseLdClassicXCodeLinker)' != 'false' and '$(_IsApplePlatform)' == 'true'">
179+
<CustomLinkerArg Condition="'$(_XcodeVersion)' &gt;= '15'" Include="-ld_classic" />
180+
</ItemGroup>
181+
169182
<PropertyGroup>
170183
<_CommandProbe>command -v</_CommandProbe>
171184
<_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
@@ -70,6 +70,19 @@
7070
<Output TaskParameter="ConsoleOutput" PropertyName="_CC_LDFLAGS" />
7171
</Exec>
7272

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

0 commit comments

Comments
 (0)