From 64c286c8b6f4712d07b5c7dfbcc6130efe318b8b Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Fri, 1 Apr 2022 10:22:28 -0700 Subject: [PATCH] Publish crossgen as AOT if supported by the target platform (#65948) Publishes crossgen as an AOT binary on Windows+Linux x64+ARM64, otherwise publishes as an R2R single file. Closes #60016 (cherry picked from commit 0d1e04ba2a9ebc9d21a7f65db00407dd0056b547) --- eng/Subsets.props | 3 +- eng/liveBuilds.targets | 15 +++ eng/testing/tests.singlefile.targets | 2 - .../SymbolReader/UnmanagedPdbSymbolReader.cs | 2 +- .../tools/aot/ILCompiler/ILCompiler.props | 6 +- .../tools/aot/crossgen2/crossgen2.csproj | 49 +++++++- .../tools/aot/crossgen2/crossgen2.props | 10 +- .../Microsoft.NETCore.App.Crossgen2.sfxproj | 105 +++++++++--------- 8 files changed, 123 insertions(+), 69 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index b556df68ea642..bd1cda47e06d0 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -71,8 +71,7 @@ libs.native+ - $(DefaultLibrariesSubsets)libs.sfx+libs.oob - $(DefaultLibrariesSubsets)+libs.pretest + $(DefaultLibrariesSubsets)libs.sfx+libs.oob+libs.pretest host.native+host.tools $(DefaultHostSubsets)+host.pkg+host.tests diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index a8e8fffe47011..0583f48aed5cf 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -49,6 +49,7 @@ x86 x64 x64 + $(CoreCLRArtifactsPath)/corehost/singlefilehost$(ExeSuffix) @@ -222,4 +223,18 @@ $(RuntimeIdGraphDefinitionFile) + + + + + + + + $(MicrosoftNetCoreAppRuntimePackDir) + + + diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets index e5f12a683a9f7..f95e1957de028 100644 --- a/eng/testing/tests.singlefile.targets +++ b/eng/testing/tests.singlefile.targets @@ -16,8 +16,6 @@ true true true - $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(Configuration)', 'corehost'))/singlefilehost - $(SingleFileHostSourcePath).exe diff --git a/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/UnmanagedPdbSymbolReader.cs b/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/UnmanagedPdbSymbolReader.cs index f6e5459a59f95..f7a7074cca5ff 100644 --- a/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/UnmanagedPdbSymbolReader.cs +++ b/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/UnmanagedPdbSymbolReader.cs @@ -25,7 +25,7 @@ namespace Internal.TypeSystem.Ecma /// public abstract class UnmanagedPdbSymbolReader : PdbSymbolReader { - public static PdbSymbolReader TryOpenSymbolReaderForMetadataFile(string metadataFileName, string searchPath) + public static PdbSymbolReader? TryOpenSymbolReaderForMetadataFile(string metadataFileName, string searchPath) { return null; } diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props index 936823572cb95..61b23fd75d112 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props @@ -120,16 +120,18 @@ $(TargetOSComponent)_$(TargetArchitectureForLocalJitBuild)_$(TargetArchitectureForSharedLibraries) $(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix) + + $(RuntimeBinDir)$(CrossHostArch) - - + + + + - $(RuntimeBinDir)/crossgen2 - - true - $(Crossgen2PackageRID) + $(RuntimeBinDir)crossgen2 + + false + + true + linux-x64;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;freebsd-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm + + + + true + true + + false + + false + true + + + + + + $(CoreCLRILCompilerDir) + $(CoreCLRCrossILCompilerDir) + clang-9 + $(ROOTFS_DIR) + $(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll + $(CoreCLRAotSdkDir) + $(MicrosoftNetCoreAppRuntimePackRidLibTfmDir) + $(MicrosoftNetCoreAppRuntimePackNativeDir) + false + + + true + + + + + diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props index a0d31077248d5..d544530d81378 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.props +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props @@ -68,16 +68,18 @@ $(TargetOSComponent)_$(TargetArchitectureForLocalJitBuild)_$(TargetArchitectureForSharedLibraries) $(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix) + + $(RuntimeBinDir)$(CrossHostArch) - - $(TargetArchitectureForSharedLibraries) amd64 Microsoft.DiaSymReader.Native.$(DiaSymReaderTargetArch).dll - $(PkgMicrosoft_DiaSymReader_Native)\runtimes\win\native\$(DiaSymReaderTargetArchFileName) + $(PkgMicrosoft_DiaSymReader_Native)\runtimes\win\native\$(DiaSymReaderTargetArchFileName) + + $(CoreCLRArtifactsPath)crossgen2/$(DiaSymReaderTargetArchFileName) diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index 2dbe486d0538d..8841f1ab9b3b7 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -3,8 +3,9 @@ - true - RuntimePack + + true + ToolPack $(SharedFrameworkName).Crossgen2 .PGO $(SharedFrameworkName)$(PgoSuffix).$(RuntimeIdentifier) @@ -13,56 +14,65 @@ linux-x64;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;freebsd-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm false - - AddRuntimeFilesToPackage; - AddFrameworkFilesToPackage - - true - - false - - false tools/ true + + false - - unix - win - $(TargetOSComponent)-$(TargetArchitecture) - + - - - - - - - - - - - - - - - + + + + + + - - - - - + <_CrossgenPublishFiles Include="@(_RawCrossgenPublishFiles->'%(OutputPath)')" + KeepMetadata="REMOVE_ALL" /> + + + + + + + - - - - + + + + + + + + + unix + win + $(TargetOSComponent)-$(TargetArchitecture) + + <_Crossgen2SymbolFilesToPackage Include="@(Reference->'$(CoreCLRArtifactsPath)PDB\%(FileName).pdb')" /> @@ -75,22 +85,8 @@ - - - <_diaSymTargetArch>$(TargetArchitecture) - <_diaSymTargetArch Condition="'$(TargetArchitecture)' == 'x64'">amd64 - <_diaSymReaderTargetArchPath>$(PkgMicrosoft_DiaSymReader_Native)/runtimes/win/native/Microsoft.DiaSymReader.Native.$(_diaSymTargetArch).dll - - - - - - - - - +