- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Fix issue #114504 by not emitting empty gcrefmaps in R2R #118594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…is was causing R2Rdump to explode)
| /azp run runtime-coreclr crossgen2 outerloop | 
| Azure Pipelines successfully started running 1 pipeline(s). | 
        
          
                ...reclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...reclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | /azp run runtime-coreclr crossgen2 outerloop | 
| Azure Pipelines successfully started running 1 pipeline(s). | 
        
          
                .../tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionNode.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | /azp run runtime-coreclr crossgen2 outerloop | 
| Azure Pipelines successfully started running 1 pipeline(s). | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 IsEmptyproperty 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 -Ooptimization flag that was previously commented out | 
Should fix #114504
cc @davidwrighton