Create crossgen symbols for Windows x64 and x86 (#12157)

This commit is contained in:
Travis Plunk 2020-03-19 17:24:27 -07:00 committed by GitHub
parent 495dea0783
commit 3ab605aeec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 110 additions and 12 deletions

View file

@ -3116,6 +3116,42 @@
<Component Id="cmp798A4EE6784541FE9B13582E52C5A818" Guid="{ec646ea5-c60e-41d5-9fd0-36fb14b1fc28}">
<File Id="fil8A6290BE106E416CB35FB2BEA982C3B8" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.VisualBasic.Forms.dll" />
</Component>
<Component Id="cmp786425328E3249EEBF16EB0D3CB75A52" Guid="{cb836f76-62cb-4785-8878-4383a4e8841e}">
<File Id="fil183FB26B5DFA4AE6AB5D4C7296E87EE1" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.WSMan.Management.pdb" />
</Component>
<Component Id="cmpFA1D677C9EBC4896B88D314998E0C1FA" Guid="{138e16d8-de8b-425c-a96b-4c264c7c0796}">
<File Id="filD87BE8939E984A56924B2865CF4240C2" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.PowerShell.CoreCLR.Eventing.pdb" />
</Component>
<Component Id="cmp3AAEDCB97741429DB5095B5B5DD02D37" Guid="{ec61f325-e673-486d-93d5-9a4272fe0377}">
<File Id="fil7413F746000740FDB9F05CF8B79D113D" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.WSMan.Runtime.pdb" />
</Component>
<Component Id="cmpDE73FE34660445FE81B6998A20CA0880" Guid="{a5d5bc43-d8d7-43e4-be78-887a4b8d723b}">
<File Id="filC5F45F8D58924B0696386CFB678E0956" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.Management.Infrastructure.CimCmdlets.pdb" />
</Component>
<Component Id="cmp72C42B8BDA574E99A9BDE1D1AC779D77" Guid="{da48fc69-2513-4fa5-a8ce-83316526d783}">
<File Id="filE0EA52D82BDA4522BEEE62DEA96D02C7" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.PowerShell.Commands.Diagnostics.pdb" />
</Component>
<Component Id="cmpC0D2113AAD1244BA8B3668D43F472F26" Guid="{cb0910cc-07aa-4409-9ddb-a96f4476fe82}">
<File Id="fil52C763AEBFC64A24A62A49AD9C82361A" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.PowerShell.GraphicalHost.pdb" />
</Component>
<Component Id="cmp43FEAB9E32934C98926E65185896CE88" Guid="{2cb23b70-a8db-4e8f-80d4-30c6243d4ff2}">
<File Id="fil87BB9E5C8A0249959A8878652E2AB027" KeyPath="yes" Source="$(env.ProductSourcePath)\pwsh.pdb" />
</Component>
<Component Id="cmpB1F91CE907214A46B7158AA391E3ACC4" Guid="{52709dae-46b8-45d2-b794-cdabd795a300}">
<File Id="fil9227479D83A44476A60264ED312EF0B6" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.PowerShell.Commands.Utility.pdb" />
</Component>
<Component Id="cmp9DA40D9DBE9B43A9925D9F63536D893A" Guid="{29479725-03b3-4947-9591-03368b09f496}">
<File Id="fil126141BB03DD4BE3B36D0580C755229B" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.PowerShell.ConsoleHost.pdb" />
</Component>
<Component Id="cmp392918B7D32C4319A4D9D71FF8302519" Guid="{b9c74b02-be75-4539-af5d-40f0d17ce44f}">
<File Id="fil390A3298638A4A34B89793326C4142F0" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.PowerShell.Security.pdb" />
</Component>
<Component Id="cmp0BFAF714EC6D4ADA8F1479A373426ABC" Guid="{31b760ab-fe53-4042-b3ab-c1618e6fd123}">
<File Id="filF12942D4CF374E9B8BD66B9D715C1870" KeyPath="yes" Source="$(env.ProductSourcePath)\Microsoft.PowerShell.Commands.Management.pdb" />
</Component>
<Component Id="cmp32AF38A70A52494B9387DA0DA3720A9B" Guid="{018466b9-38dd-4403-8ee4-c2b70d6bc64b}">
<File Id="fil0D62321987A1455194D789777F82EDAA" KeyPath="yes" Source="$(env.ProductSourcePath)\System.Management.Automation.pdb" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
@ -4120,6 +4156,18 @@
<ComponentRef Id="cmp38D8A48C68FB4CB399A0A7677FA428E4" />
<ComponentRef Id="cmp26335B5D1FE94E87A6B6EBD56A22C2B9" />
<ComponentRef Id="cmp57D197B18F1F4A6AAB704B28CF61B535" />
<ComponentRef Id="cmp786425328E3249EEBF16EB0D3CB75A52" />
<ComponentRef Id="cmpFA1D677C9EBC4896B88D314998E0C1FA" />
<ComponentRef Id="cmp3AAEDCB97741429DB5095B5B5DD02D37" />
<ComponentRef Id="cmpDE73FE34660445FE81B6998A20CA0880" />
<ComponentRef Id="cmp72C42B8BDA574E99A9BDE1D1AC779D77" />
<ComponentRef Id="cmpC0D2113AAD1244BA8B3668D43F472F26" />
<ComponentRef Id="cmp43FEAB9E32934C98926E65185896CE88" />
<ComponentRef Id="cmpB1F91CE907214A46B7158AA391E3ACC4" />
<ComponentRef Id="cmp9DA40D9DBE9B43A9925D9F63536D893A" />
<ComponentRef Id="cmp392918B7D32C4319A4D9D71FF8302519" />
<ComponentRef Id="cmp0BFAF714EC6D4ADA8F1479A373426ABC" />
<ComponentRef Id="cmp32AF38A70A52494B9387DA0DA3720A9B" />
</ComponentGroup>
</Fragment>
</Wix>

View file

@ -2214,16 +2214,54 @@ function Start-CrossGen {
# Generate the ngen assembly
Write-Verbose "Generating assembly $niAssemblyName"
Start-NativeExecution {
& $CrossgenPath /MissingDependenciesOK /in $AssemblyPath /out $outputAssembly /Platform_Assemblies_Paths $platformAssembliesPath
& $CrossgenPath /ReadyToRun /MissingDependenciesOK /in $AssemblyPath /out $outputAssembly /Platform_Assemblies_Paths $platformAssembliesPath
} | Write-Verbose
} finally {
Pop-Location
}
}
<#
# TODO: Generate the pdb for the ngen binary - currently, there is a hard dependency on diasymreader.dll, which is available at %windir%\Microsoft.NET\Framework\v4.0.30319.
# However, we still need to figure out the prerequisites on Linux.
Start-NativeExecution {
& $CrossgenPath /Platform_Assemblies_Paths $platformAssembliesPath /CreatePDB $platformAssembliesPath /lines $platformAssembliesPath $niAssemblyName
} | Write-Verbose
#>
function New-CrossGenSymbol {
param (
[Parameter(Mandatory= $true)]
[ValidateNotNullOrEmpty()]
[String]
$AssemblyPath,
[Parameter(Mandatory= $true)]
[ValidateNotNullOrEmpty()]
[String]
$CrossgenPath
)
$platformAssembliesPath = Split-Path $AssemblyPath -Parent
$crossgenFolder = Split-Path $CrossgenPath
try {
Push-Location $crossgenFolder
$symbolsPath = [System.IO.Path]::ChangeExtension($assemblyPath, ".pdb")
$createSymbolOptionName = $null
if($Environment.IsWindows)
{
$createSymbolOptionName = '-CreatePDB'
}
elseif ($Environment.IsLinux)
{
$createSymbolOptionName = '-CreatePerfMap'
}
if($createSymbolOptionName)
{
Start-NativeExecution {
& $CrossgenPath -readytorun -platform_assemblies_paths $platformAssembliesPath $createSymbolOptionName $platformAssembliesPath $AssemblyPath
} | Write-Verbose
}
# Rename the corresponding ni.dll assembly to be the same as the IL assembly
$niSymbolsPath = [System.IO.Path]::ChangeExtension($symbolsPath, "ni.pdb")
Rename-Item $niSymbolsPath $symbolsPath -Force -ErrorAction Stop
} finally {
Pop-Location
}
@ -2235,18 +2273,24 @@ function Start-CrossGen {
# Get the path to crossgen
$crossGenExe = if ($environment.IsWindows) { "crossgen.exe" } else { "crossgen" }
$generateSymbols = $false
# The crossgen tool is only published for these particular runtimes
$crossGenRuntime = if ($environment.IsWindows) {
if ($Runtime -match "-x86") {
"win-x86"
$generateSymbols = $true
} elseif ($Runtime -match "-x64") {
"win-x64"
$generateSymbols = $true
} elseif (!($env:PROCESSOR_ARCHITECTURE -match "arm")) {
throw "crossgen for 'win-arm' and 'win-arm64' must be run on that platform"
}
} elseif ($Runtime -eq "linux-arm") {
throw "crossgen is not available for 'linux-arm'"
} elseif ($Runtime -eq "linux-x64") {
$Runtime
# We should set $generateSymbols = $true, but the code needs to be adjusted for different extension on Linux
} else {
$Runtime
}
@ -2362,15 +2406,21 @@ function Start-CrossGen {
Remove-Item $assemblyPath -Force -ErrorAction Stop
# Rename the corresponding ni.dll assembly to be the same as the IL assembly
$niAssemblyPath = [System.IO.Path]::ChangeExtension($assemblyPath, "ni.dll")
Rename-Item $niAssemblyPath $assemblyPath -Force -ErrorAction Stop
# No symbols are available for Microsoft.CodeAnalysis.CSharp.dll, Microsoft.CodeAnalysis.dll,
# Microsoft.CodeAnalysis.VisualBasic.dll, and Microsoft.CSharp.dll.
if ($commonAssembliesForAddType -notcontains $assemblyName) {
Remove-Item $symbolsPath -Force -ErrorAction Stop
}
# Rename the corresponding ni.dll assembly to be the same as the IL assembly
$niAssemblyPath = [System.IO.Path]::ChangeExtension($assemblyPath, "ni.dll")
Rename-Item $niAssemblyPath $assemblyPath -Force -ErrorAction Stop
if($generateSymbols)
{
Write-Verbose "Generating Symbols for $assemblyPath"
New-CrossGenSymbol -CrossgenPath $crossGenPath -AssemblyPath $assemblyPath
}
}
}
}