From abf49ed92b6e125c5f8cd5d27325763937d1b479 Mon Sep 17 00:00:00 2001 From: Fadi Hanna Date: Wed, 4 Dec 2019 11:59:32 -0800 Subject: [PATCH 1/2] Reference the test working directory when running crossgen2 --- src/coreclr/tests/src/CLRTest.CrossGen.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tests/src/CLRTest.CrossGen.targets b/src/coreclr/tests/src/CLRTest.CrossGen.targets index 097adb1a281312..c074e680fc8f8b 100644 --- a/src/coreclr/tests/src/CLRTest.CrossGen.targets +++ b/src/coreclr/tests/src/CLRTest.CrossGen.targets @@ -69,7 +69,7 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then mkdir IL cp $(MSBuildProjectName).dll IL/$(MSBuildProjectName).dll mv $(MSBuildProjectName).dll $(MSBuildProjectName).org - __Command=$_DebuggerFullPath "$CORE_ROOT/crossgen2/crossgen2" -r:$CORE_ROOT/*.dll --targetarch=x64 -O --inputbubble -o:$(scriptPath)$(MSBuildProjectName).dll $(scriptPath)$(MSBuildProjectName).org + __Command=$_DebuggerFullPath "$CORE_ROOT/crossgen2/crossgen2" -r:$CORE_ROOT/*.dll -r:$PWD/*.dll --targetarch=x64 -O --inputbubble -o:$(scriptPath)$(MSBuildProjectName).dll $(scriptPath)$(MSBuildProjectName).org echo $__Command $__Command __cg2ExitCode=$? @@ -130,7 +130,7 @@ if defined RunCrossGen2 ( mkdir IL copy $(MSBuildProjectName).dll IL\$(MSBuildProjectName).dll ren $(MSBuildProjectName).dll $(MSBuildProjectName).org - set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2" %21scriptPath%21$(MSBuildProjectName).org -o:%21scriptPath%21$(MSBuildProjectName).dll --targetarch:x64 -O --inputbubble -r:!CORE_ROOT!\*.dll + set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2" %21scriptPath%21$(MSBuildProjectName).org -o:%21scriptPath%21$(MSBuildProjectName).dll --targetarch:x64 -O --inputbubble -r:!CORE_ROOT!\*.dll -r:%25cd%25\*.dll echo "!__Command!" call !__Command! set CrossGen2Status=!ERRORLEVEL! From baef65d23da2ff6bd9feaacd68dbe563c1e92d82 Mon Sep 17 00:00:00 2001 From: Fadi Hanna Date: Wed, 4 Dec 2019 17:05:38 -0800 Subject: [PATCH 2/2] Fix GCRefMapBuilder to correctly detect if certain methods are "empty" and not crash --- .../Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs index 416016ee29d613..07dfd94cce4845 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs @@ -83,7 +83,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) for (int methodIndex = 0; methodIndex < _methods.Count; methodIndex++) { IMethodNode methodNode = _methods[methodIndex]; - if (methodNode == null || (methodNode is MethodWithGCInfo methodWithGCInfo && methodWithGCInfo.IsEmpty)) + if (methodNode == null || (methodNode is LocalMethodImport localMethod && localMethod.MethodCodeNode.IsEmpty)) { // Flush an empty GC ref map block to prevent // the indexed records from falling out of sync with methods