Fix issue #114504 by not emitting empty gcrefmaps in R2R#118594
Merged
kg merged 6 commits intodotnet:mainfrom Aug 12, 2025
Merged
Fix issue #114504 by not emitting empty gcrefmaps in R2R#118594kg merged 6 commits intodotnet:mainfrom
kg merged 6 commits intodotnet:mainfrom
Conversation
…is was causing R2Rdump to explode)
Member
Author
|
/azp run runtime-coreclr crossgen2 outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jkotas
reviewed
Aug 11, 2025
...reclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs
Outdated
Show resolved
Hide resolved
jkotas
reviewed
Aug 11, 2025
...reclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs
Outdated
Show resolved
Hide resolved
This was referenced Aug 11, 2025
Open
Member
Author
|
/azp run runtime-coreclr crossgen2 outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jkotas
reviewed
Aug 12, 2025
.../tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionNode.cs
Outdated
Show resolved
Hide resolved
This was referenced Aug 12, 2025
Member
Author
|
/azp run runtime-coreclr crossgen2 outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #114504 by preventing empty GC reference maps from being emitted in Ready-to-Run (R2R) images. The fix avoids generating RVAs for empty gcrefmaps which were causing r2rdump to fail when reading them due to missing size headers.
- Adds an
IsEmptyproperty toGCRefMapNodeto check if the map contains methods - Modifies
ImportSectionNodeto only emit gcrefmap RVAs when the map is not empty - Re-enables optimization flag
-Oin CrossGen2 targets that was previously disabled due to this issue
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs |
Adds IsEmpty property to check if GC reference map contains any methods |
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionNode.cs |
Removes field and parameter tracking, uses null-conditional operators, and only emits gcrefmap RVAs for non-empty maps |
src/tests/Common/CLRTest.CrossGen.targets |
Re-enables the -O optimization flag that was previously commented out |
.../tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionNode.cs
Show resolved
Hide resolved
jkotas
reviewed
Aug 12, 2025
.../tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionNode.cs
Show resolved
Hide resolved
jkotas
approved these changes
Aug 12, 2025
This was referenced Aug 12, 2025
kg
added a commit
that referenced
this pull request
Aug 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Should fix #114504
cc @davidwrighton