Skip to content

Commit 7e9cab2

Browse files
Revert "Consolidate <NativeAotSupported definitions (#103273)" (#103497)
* Revert "Do not set UseNativeAotForComponents for arm32 MUSL (#103469)" This reverts commit f1f0750. * Revert "Set UseNativeAotForComponents to false on bionic (#103454)" This reverts commit d901213. * Revert "Try fixing x86 Windows legs (#103411)" This reverts commit 6927fea. * Revert "Consolidate <NativeAotSupported definitions (#103273)" This reverts commit b86c463.
1 parent 0f0981f commit 7e9cab2

File tree

5 files changed

+44
-21
lines changed

5 files changed

+44
-21
lines changed

eng/Subsets.props

+1-5
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@
121121
<!-- CLR NativeAot only builds in a subset of the matrix -->
122122
<_NativeAotSupportedOS Condition="'$(TargetOS)' == 'windows' or '$(TargetOS)' == 'linux' or '$(TargetOS)' == 'osx' or '$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'freebsd'">true</_NativeAotSupportedOS>
123123
<_NativeAotSupportedArch Condition="'$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm' or ('$(TargetOS)' == 'windows' and '$(TargetArchitecture)' == 'x86')">true</_NativeAotSupportedArch>
124-
<NativeAotSupported Condition="'$(_NativeAotSupportedOS)' == 'true' and '$(_NativeAotSupportedArch)' == 'true'">true</NativeAotSupported>
125-
<UseNativeAotForComponents Condition="'$(NativeAotSupported)' == 'true' and '$(TargetOS)' == '$(HostOS)' and ('$(TargetOS)' != 'windows' or '$(TargetArchitecture)' != 'x86') and '$(TargetsLinuxBionic)' != 'true' and ('$(TargetsLinuxMusl)' != 'true' or '$(TargetArchitecture)' != 'arm')">true</UseNativeAotForComponents>
124+
<NativeAotSupported Condition="'$(_NativeAotSupportedOS)' == 'true' and $(_NativeAotSupportedArch) == 'true'">true</NativeAotSupported>
126125

127126
<!-- If we're building clr.nativeaotlibs and not building the CLR runtime, compile libraries against NativeAOT CoreLib -->
128127
<UseNativeAotCoreLib Condition="'$(TestNativeAot)' == 'true' or ($(_subset.Contains('+clr.nativeaotlibs+')) and !$(_subset.Contains('+clr.native+')) and !$(_subset.Contains('+clr.runtime+')) and !$(_subset.Contains('+clr.corelib+')))">true</UseNativeAotCoreLib>
@@ -287,10 +286,7 @@
287286
AdditionalProperties="%(AdditionalProperties);
288287
ClrCrossComponentsSubset=true;
289288
HostArchitecture=$(BuildArchitecture);
290-
TargetArchitecture=$(TargetArchitecture);
291289
HostCrossOS=$(HostOS);
292-
HostOS=$(HostOS);
293-
TargetOS=$(TargetOS);
294290
PgoInstrument=false;
295291
NoPgoOptimize=true;
296292
CrossBuild=false;

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

+14-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@
1010
<!-- BEGIN: Workaround for https://github.com/dotnet/runtime/issues/67742 -->
1111
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
1212
<PublishDir>$(RuntimeBinDir)ilc-published/</PublishDir>
13-
<PublishAot Condition="'$(UseNativeAotForComponents)' == 'true'">true</PublishAot>
14-
<SysRoot Condition="'$(UseNativeAotForComponents)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
15-
<PublishReadyToRun Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishReadyToRun>
16-
<PublishSingleFile Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishSingleFile>
17-
<PublishTrimmed Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishTrimmed>
13+
<NativeAotSupported Condition="$(OutputRID.StartsWith('tizen')) == 'true'">false</NativeAotSupported>
14+
<NativeAotSupported Condition="$(OutputRID.EndsWith('-arm')) == 'true'">false</NativeAotSupported>
15+
<NativeAotSupported Condition="$(OutputRID.EndsWith('-x86')) == 'true'">false</NativeAotSupported>
16+
<!-- Disable native AOT on FreeBSD when cross building from Linux. -->
17+
<NativeAotSupported Condition="'$(TargetOS)' == 'freebsd' and '$(CrossBuild)' == 'true'">false</NativeAotSupported>
18+
<PublishAot Condition="'$(NativeAotSupported)' == 'true'">true</PublishAot>
19+
<SysRoot Condition="'$(NativeAotSupported)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
20+
<PublishReadyToRun Condition="'$(NativeAotSupported)' != 'true'">true</PublishReadyToRun>
21+
<PublishSingleFile Condition="'$(NativeAotSupported)' != 'true'">true</PublishSingleFile>
22+
<PublishTrimmed Condition="'$(NativeAotSupported)' != 'true'">true</PublishTrimmed>
1823
<SuppressGenerateILCompilerExplicitPackageReferenceWarning>true</SuppressGenerateILCompilerExplicitPackageReferenceWarning>
1924
</PropertyGroup>
2025

21-
<ItemGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
26+
<ItemGroup Condition="'$(NativeAotSupported)' == 'true'">
2227
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerVersion)" />
2328
<PackageReference Include="runtime.$(ToolsRID).Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerVersion)" />
2429
</ItemGroup>
@@ -48,7 +53,7 @@
4853
</Target>
4954

5055
<Target Name="LocateNativeCompiler"
51-
Condition="'$(UseNativeAotForComponents)' == 'true' and '$(HostOS)' != 'windows'"
56+
Condition="'$(NativeAotSupported)' == 'true' and '$(HostOS)' != 'windows'"
5257
BeforeTargets="SetupOSSpecificProps">
5358
<PropertyGroup>
5459
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker>
@@ -70,7 +75,7 @@
7075
<_XcodeVersion>$([System.Text.RegularExpressions.Regex]::Match($(_XcodeVersionString), '[1-9]\d*'))</_XcodeVersion>
7176
</PropertyGroup>
7277

73-
<ItemGroup Condition="'$(UseNativeAotForComponents)' == 'true' and '$(_IsApplePlatform)' == 'true'">
78+
<ItemGroup Condition="'$(NativeAotSupported)' == 'true' and '$(_IsApplePlatform)' == 'true'">
7479
<CustomLinkerArg Condition="'$(_XcodeVersion)' &gt;= '15'" Include="-ld_classic" />
7580
</ItemGroup>
7681

@@ -81,7 +86,7 @@
8186
</PropertyGroup>
8287
</Target>
8388

84-
<ItemGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
89+
<ItemGroup Condition="'$(NativeAotSupported)' == 'true'">
8590
<CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(BuildArchitecture)' == '$(_targetArchitecture)' and '$(HostOS)' != 'windows' and '$(_IsApplePlatform)' != 'true'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
8691
</ItemGroup>
8792

src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj

+10-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
88

99
<PropertyGroup>
10+
<NativeAotSupported Condition="$(OutputRID.StartsWith('tizen')) == 'true'">false</NativeAotSupported>
11+
<NativeAotSupported Condition="$(OutputRID.EndsWith('-arm')) == 'true'">false</NativeAotSupported>
12+
<NativeAotSupported Condition="$(OutputRID.EndsWith('-x86')) == 'true'">false</NativeAotSupported>
13+
<!-- Publish crossgen2 as a single-file app on native-OS builds. Cross-OS NativeAOT compilation is not supported yet -->
14+
<NativeAotSupported Condition="'$(CrossBuild)' == 'true' and '$(TargetOS)' != '$(HostOS)'">false</NativeAotSupported>
1015
<PublishTrimmed>true</PublishTrimmed>
1116
<RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
1217
<SelfContained>true</SelfContained>
@@ -16,7 +21,7 @@
1621

1722
<Import Project="crossgen2.props" />
1823

19-
<PropertyGroup Condition="'$(UseNativeAotForComponents)' != 'true'">
24+
<PropertyGroup Condition="'$(NativeAotSupported)' != 'true'">
2025
<PublishSingleFile>true</PublishSingleFile>
2126
<PublishReadyToRun>true</PublishReadyToRun>
2227
<!-- Disable crossgen on NetBSD, illumos, Solaris, and Haiku for now. This can be revisited when we have full support. -->
@@ -36,7 +41,7 @@
3641
<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" />
3742
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />
3843

39-
<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
44+
<PropertyGroup Condition="'$(NativeAotSupported)' == 'true'">
4045
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
4146
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
4247
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
@@ -50,12 +55,12 @@
5055
<DsymUtilOptions Condition="'$(_IsApplePlatform)' == 'true'">--flat</DsymUtilOptions>
5156
</PropertyGroup>
5257

53-
<ItemGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
58+
<ItemGroup Condition="'$(NativeAotSupported)' == 'true'">
5459
<CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_IsApplePlatform)' != 'true' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
5560
</ItemGroup>
5661

5762
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.SingleEntry.targets"
58-
Condition="'$(UseNativeAotForComponents)' == 'true'" />
63+
Condition="'$(NativeAotSupported)' == 'true'" />
5964
<Import Project="$(RepositoryEngineeringDir)nativeSanitizers.targets" />
6065

6166
<!-- Needed for the amd64 -> amd64 musl cross-build to pass the target flag. -->
@@ -83,7 +88,7 @@
8388
</Target>
8489

8590
<Target Name="LocateNativeCompiler"
86-
Condition="'$(UseNativeAotForComponents)' == 'true' and '$(HostOS)' != 'windows'"
91+
Condition="'$(NativeAotSupported)' == 'true' and '$(HostOS)' != 'windows'"
8792
BeforeTargets="SetupOSSpecificProps">
8893
<PropertyGroup>
8994
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker>

src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<PermitDllAndExeFilesLackingFileVersion>true</PermitDllAndExeFilesLackingFileVersion>
1616
<!-- Publishing as single-file or NativeAOT means we can't examine the interior DLLs -->
1717
<ShouldVerifyClosure>false</ShouldVerifyClosure>
18+
<!-- Publish crossgen2 as a single-file app on native-OS builds. Cross-OS NativeAOT compilation is not supported yet -->
19+
<NativeAotSupported Condition="'$(CrossBuild)' == 'true' and '$(TargetOS)' != '$(HostOS)'">false</NativeAotSupported>
1820
</PropertyGroup>
1921

2022
<ItemGroup>

src/native/managed/compile-native.proj

+17-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,26 @@
1313
<NativeLibsProjectsToBuild Include="$(MSBuildThisFileDirectory)cdacreader/src/cdacreader.csproj" />
1414
</ItemGroup>
1515

16+
<!-- Decide if we're going to do the NativeAOT builds -->
17+
<PropertyGroup>
18+
<!-- disable on Mono, for now -->
19+
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and '$(RuntimeFlavor)' == 'Mono'">false</SupportsNativeAotComponents>
20+
<!-- disable on linux-bionic, for now -->
21+
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and '$(TargetsLinuxBionic)' == 'true'">false</SupportsNativeAotComponents>
22+
<!-- NativeAOT doesn't support cross-OS compilation. disable for crossdac-->
23+
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and '$(HostOS)' != '$(TargetOS)'">false</SupportsNativeAotComponents>
24+
<!-- unsupported targets -->
25+
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and '$(DotNetBuildSourceOnly)' == 'true'">false</SupportsNativeAotComponents>
26+
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and ('$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'armel' or '$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'riscv64')">false</SupportsNativeAotComponents>
27+
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and ('$(TargetsWindows)' == 'true' or '$(TargetsOSX)' == 'true' or ('$(TargetsLinux)' == 'true' and '$(TargetsAndroid)' != 'true' and '$(TargetsLinuxMusl)' != 'true'))">true</SupportsNativeAotComponents>
28+
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == ''">false</SupportsNativeAotComponents>
29+
</PropertyGroup>
30+
1631
<!-- some special kinds of runtime builds need extra NativeAOT flags -->
1732
<PropertyGroup>
1833
<SysRoot Condition="'$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
1934
<LinkerFlavor Condition="'$(CrossBuild)' == 'true' and '$(TargetsLinux)' == 'true'">lld</LinkerFlavor>
20-
<CustomLinkerArgToolchainArg Condition="'$(CrossBuild)' == 'true' and '$(HostArchitecture)' == '$(TargetArchitecture)' and '$(HostOS)' != 'windows'">--gcc-toolchain=$(ROOTFS_DIR)/usr</CustomLinkerArgToolchainArg>
35+
<CustomLinkerArgToolchainArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'">--gcc-toolchain=$(ROOTFS_DIR)/usr</CustomLinkerArgToolchainArg>
2136
</PropertyGroup>
2237

2338
<ItemGroup>
@@ -36,6 +51,6 @@
3651
ReferenceOutputAssembly="false"
3752
AdditionalProperties="%(AdditionalProperties);$(SplitSubprojectProps)"
3853
Targets="LinkNative"
39-
Condition="'$(UseNativeAotForComponents)' == 'true'"/>
54+
Condition="$(SupportsNativeAotComponents)"/>
4055
</ItemGroup>
4156
</Project>

0 commit comments

Comments
 (0)