Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomáš Rylek <trylek@microsoft.com>2020-11-12 05:01:15 +0300
committerGitHub <noreply@github.com>2020-11-12 05:01:15 +0300
commite33ba5d5f2df5180e8b83d9f6237be3934386f45 (patch)
tree3c0a4ad8cb49df863f752ad3a0fa2e757c0d894b /src/coreclr/crossgen-corelib.proj
parenta207c7f5df922560aac9028a2d7416116d38fce6 (diff)
Crossgen2 support for System.Private.CoreLib compilation in CoreCLR build (#44090)
This change moves the logic for crossgenning System.Private.CoreLib to the crossgen-corelib.proj script, no longer calling out to the OS-specific scripts crossgen-corelib.cmd / crossgen-corelib.sh, and adds the support for using Crossgen2 for the System.Private.CoreLib compilation. As of this commit Crossgen2 is not set as the default because the System.Utf8.Experimental libraries tests fail with Crossgen2-compiled CoreLib. I'm working on fixing this as the next step. Thanks Tomas
Diffstat (limited to 'src/coreclr/crossgen-corelib.proj')
-rw-r--r--src/coreclr/crossgen-corelib.proj102
1 files changed, 91 insertions, 11 deletions
diff --git a/src/coreclr/crossgen-corelib.proj b/src/coreclr/crossgen-corelib.proj
index bf26cd259a8..6144cbfaf08 100644
--- a/src/coreclr/crossgen-corelib.proj
+++ b/src/coreclr/crossgen-corelib.proj
@@ -3,21 +3,101 @@
<Import Project="Directory.Build.targets" />
<Target Name="Build">
- <ItemGroup>
- <_CoreClrBuildArg Condition="'$(TargetArchitecture)' != ''" Include="-$(TargetArchitecture)" />
- <_CoreClrBuildArg Include="-$(Configuration.ToLower())" />
- <_CoreClrBuildArg Condition="!$([MSBuild]::IsOsPlatform(Windows))" Include="-os $(TargetOS)" />
- <_CoreClrBuildArg Condition="'$(CrossBuild)' == 'true'" Include="-cross" />
- <_CoreClrBuildArg Condition="'$(PortableBuild)' != 'true'" Include="-portablebuild=false" />
- </ItemGroup>
+ <PropertyGroup>
+ <!-- Default for using Crossgen2 when not set externally -->
+ <UseCrossgen2 Condition="'$(UseCrossgen2)' == ''">false</UseCrossgen2>
+
+ <OSPlatformConfig>$(TargetOS).$(TargetArchitecture).$(Configuration)</OSPlatformConfig>
+ <RootBinDir>$(RepoRoot)\artifacts</RootBinDir>
+ <LogsDir>$(RootBinDir)\log</LogsDir>
+ <BinDir>$(RootBinDir)\bin\coreclr\$(OSPlatformConfig)</BinDir>
+ <IntermediatesDir>$(RootBinDir)\obj\coreclr\$(OSPlatformConfig)</IntermediatesDir>
+ <CrossGenCoreLibLog>$(LogsDir)\CrossgenCoreLib_$(TargetOS)__$(TargetArchitecture)__$(Configuration).log</CrossGenCoreLibLog>
+ <ExeExtension Condition="'$(OS)' == 'Windows_NT'">.exe</ExeExtension>
+ <DotNetCli>$(RepoRoot)/dotnet.sh</DotNetCli>
+ <DotNetCli Condition="'$(OS)' == 'Windows_NT'">$(RepoRoot)\dotnet.cmd</DotNetCli>
+
+ <CoreLibAssemblyName>System.Private.CoreLib</CoreLibAssemblyName>
+ <CoreLibInputPath>$(BinDir)\IL\$(CoreLibAssemblyName).dll</CoreLibInputPath>
+ <CoreLibOutputPath>$(BinDir)\$(CoreLibAssemblyName).dll</CoreLibOutputPath>
+
+ <CrossDir></CrossDir>
+ <CrossDir Condition="'$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'arm64'">x64</CrossDir>
+ <CrossDir Condition="'$(TargetArchitecture)' == 'arm' and '$(UseCrossgen2)' != 'true' and '$(OS)' == 'Windows_NT'">x86</CrossDir>
+ <CrossDir Condition="'$(TargetArchitecture)' == 'x86' and '$(BuildArchitecture)' != '$(TargetArchitecture)' and '$(UseCrossgen2)' == 'true'">$(BuildArchitecture)</CrossDir>
+
+ <BuildDll>true</BuildDll>
+ <BuildDll Condition="'$(CrossBuild)' == 'true' and '$(CrossDir)' == ''">false</BuildDll>
+
+ <BuildPdb>false</BuildPdb>
+ <BuildPdb Condition="$(BuildDll) and '$(OS)' == 'Windows_NT' and '$(TargetOS)' == 'Windows'">true</BuildPdb>
+
+ <BuildPerfMap>false</BuildPerfMap>
+ <BuildPerfMap Condition="$(BuildDll) and '$(TargetOS)' == 'Linux'">true</BuildPerfMap>
+
+ <CrossGen1Cmd>$(BinDir)\$(CrossDir)\crossgen$(ExeExtension)</CrossGen1Cmd>
+ <CrossGen1Cmd>$(CrossGen1Cmd) /nologo</CrossGen1Cmd>
+ <CrossGen1Cmd>$(CrossGen1Cmd) <!-- IbcTuning --></CrossGen1Cmd>
+ <CrossGen1Cmd>$(CrossGen1Cmd) /Platform_Assemblies_Paths "$(BinDir)\IL"</CrossGen1Cmd>
+ </PropertyGroup>
+
+ <MakeDir
+ Directories="$(BinDir);$(IntermediatesDir);$(LogsDir)" />
+
+ <Message Importance="High"
+ Text="Generating native image of System.Private.CoreLib for $(OSPlatformConfig). Logging to $(CrossGenCoreLibLog)" />
<PropertyGroup>
- <_CoreClrBuildScript Condition="$([MSBuild]::IsOsPlatform(Windows))">crossgen-corelib.cmd</_CoreClrBuildScript>
- <_CoreClrBuildScript Condition="!$([MSBuild]::IsOsPlatform(Windows))">crossgen-corelib.sh</_CoreClrBuildScript>
+ <CrossGenDllCmd>$(DotNetCli) $(BinDir)\$(CrossDir)\crossgen2\crossgen2.dll</CrossGenDllCmd>
+ <CrossGenDllCmd>$(CrossGenDllCmd) -o:$(CoreLibOutputPath)</CrossGenDllCmd>
+ <CrossGenDllCmd>$(CrossGenDllCmd) -r:$(BinDir)\IL\*.dll</CrossGenDllCmd>
+ <CrossGenDllCmd>$(CrossGenDllCmd) --targetarch:$(TargetArchitecture)</CrossGenDllCmd>
+ <CrossGenDllCmd>$(CrossGenDllCmd) -O</CrossGenDllCmd>
+ <CrossGenDllCmd>$(CrossGenDllCmd) $(CoreLibInputPath)</CrossGenDllCmd>
</PropertyGroup>
- <!-- Use IgnoreStandardErrorWarningFormat because Arcade sets WarnAsError and there's an existing warning in the native build. -->
- <Exec Command="&quot;$(MSBuildThisFileDirectory)$(_CoreClrBuildScript)&quot; @(_CoreClrBuildArg->'%(Identity)',' ')" />
+ <PropertyGroup Condition="'$(UseCrossgen2)' != 'true'">
+ <CrossGenDllCmd>$(CrossGen1Cmd) /out "$(CoreLibOutputPath)"</CrossGenDllCmd>
+ <CrossGenDllCmd>$(CrossGenDllCmd) "$(CoreLibInputPath)"</CrossGenDllCmd>
+ </PropertyGroup>
+
+ <!-- For now we're using Crossgen1 for generating the perf map as Crossgen2 doesn't yet implement it: -->
+ <!-- https://github.com/dotnet/runtime/issues/44123 -->
+ <PropertyGroup Condition="$(BuildPerfMap)">
+ <CrossGenPerfMapCmd>$(CrossGen1Cmd) /CreatePerfMap "$(BinDir)"</CrossGenPerfMapCmd>
+ <CrossGenPerfMapCmd>$(CrossGenPerfMapCmd) "$(CoreLibOutputPath)"</CrossGenPerfMapCmd>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="$(BuildPdb)">
+ <CrossGenPdbCmd>$(DotNetCli) $(BinDir)\r2rdump\r2rdump.dll</CrossGenPdbCmd>
+ <CrossGenPdbCmd>$(CrossGenPdbCmd) --create-pdb</CrossGenPdbCmd>
+ <CrossGenPdbCmd>$(CrossGenPdbCmd) --pdb-path:$(BinDir)\PDB</CrossGenPdbCmd>
+ <CrossGenPdbCmd>$(CrossGenPdbCmd) --in:$(CoreLibOutputPath)</CrossGenPdbCmd>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="$(BuildPdb) and '$(UseCrossgen2)' != 'true'">
+ <VsSetupCmd>call $(RepoRoot)\src\coreclr\setup_vs_tools.cmd &amp;&amp;</VsSetupCmd>
+
+ <CrossGenPdbCmd>$(VsSetupCmd) $(CrossGen1Cmd) /CreatePdb "$(BinDir)\PDB"</CrossGenPdbCmd>
+ <CrossGenPdbCmd>$(CrossGenPdbCmd) "$(CoreLibOutputPath)"</CrossGenPdbCmd>
+ </PropertyGroup>
+
+ <Message Condition="$(BuildDll)" Importance="High" Text="$(CrossGenDllCmd)" />
+
+ <Exec Condition="$(BuildDll)" Command="$(CrossGenDllCmd)" />
+
+ <Message Condition="$(BuildPdb)" Importance="High" Text="$(CrossGenPdbCmd)" />
+
+ <Exec Condition="$(BuildPdb)" Command="$(CrossGenPdbCmd)" />
+
+ <Message Condition="$(BuildPerfMap)" Importance="High" Text="$(CrossGenPerfMapCmd)" />
+
+ <Exec Condition="$(BuildPerfMap)" Command="$(CrossGenPerfMapCmd)" />
+
+ <Copy Condition="!$(BuildDll)" SourceFiles="$(CoreLibInputPath)" DestinationFiles="$(CoreLibOutputPath)" UseHardlinksIfPossible="true" />
+
+ <Message Importance="High" Text="Crossgenning of System.Private.CoreLib succeeded. Finished at $(TIME)" />
+ <Message Importance="High" Text="Product binaries are available at $(BinDir)" />
</Target>
<Target Name="Restore" />