Skip to content

Commit 48c2387

Browse files
author
Fadi Hanna
authored
Two more fixes for crossgen2 (#538)
* Reference the test working directory when running crossgen2 * Fix GCRefMapBuilder to correctly detect if certain methods are "empty" and not crash
1 parent 6a991f2 commit 48c2387

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
8383
for (int methodIndex = 0; methodIndex < _methods.Count; methodIndex++)
8484
{
8585
IMethodNode methodNode = _methods[methodIndex];
86-
if (methodNode == null || (methodNode is MethodWithGCInfo methodWithGCInfo && methodWithGCInfo.IsEmpty))
86+
if (methodNode == null || (methodNode is LocalMethodImport localMethod && localMethod.MethodCodeNode.IsEmpty))
8787
{
8888
// Flush an empty GC ref map block to prevent
8989
// the indexed records from falling out of sync with methods

src/coreclr/tests/src/CLRTest.CrossGen.targets

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
6969
mkdir IL
7070
cp $(MSBuildProjectName).dll IL/$(MSBuildProjectName).dll
7171
mv $(MSBuildProjectName).dll $(MSBuildProjectName).org
72-
__Command=$_DebuggerFullPath "$CORE_ROOT/crossgen2/crossgen2" -r:$CORE_ROOT/*.dll --targetarch=x64 -O --inputbubble -o:$(scriptPath)$(MSBuildProjectName).dll $(scriptPath)$(MSBuildProjectName).org
72+
__Command=$_DebuggerFullPath "$CORE_ROOT/crossgen2/crossgen2" -r:$CORE_ROOT/*.dll -r:$PWD/*.dll --targetarch=x64 -O --inputbubble -o:$(scriptPath)$(MSBuildProjectName).dll $(scriptPath)$(MSBuildProjectName).org
7373
echo $__Command
7474
$__Command
7575
__cg2ExitCode=$?
@@ -130,7 +130,7 @@ if defined RunCrossGen2 (
130130
mkdir IL
131131
copy $(MSBuildProjectName).dll IL\$(MSBuildProjectName).dll
132132
ren $(MSBuildProjectName).dll $(MSBuildProjectName).org
133-
set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2" %21scriptPath%21$(MSBuildProjectName).org -o:%21scriptPath%21$(MSBuildProjectName).dll --targetarch:x64 -O --inputbubble -r:!CORE_ROOT!\*.dll
133+
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
134134
echo "!__Command!"
135135
call !__Command!
136136
set CrossGen2Status=!ERRORLEVEL!

0 commit comments

Comments
 (0)