Skip to content

Conversation

@kg
Copy link
Member

@kg kg commented Aug 11, 2025

Should fix #114504

cc @davidwrighton

@kg
Copy link
Member Author

kg commented Aug 11, 2025

/azp run runtime-coreclr crossgen2 outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kg
Copy link
Member Author

kg commented Aug 12, 2025

/azp run runtime-coreclr crossgen2 outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kg kg changed the title Fix issue #114504 by adding missing size header to empty gcrefmap nodes in r2r Fix issue #114504 by not emitting empty gcrefmaps in R2R Aug 12, 2025
@kg kg marked this pull request as ready for review August 12, 2025 17:36
Copilot AI review requested due to automatic review settings August 12, 2025 17:36
@kg
Copy link
Member Author

kg commented Aug 12, 2025

/azp run runtime-coreclr crossgen2 outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a 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 IsEmpty property to GCRefMapNode to check if the map contains methods
  • Modifies ImportSectionNode to only emit gcrefmap RVAs when the map is not empty
  • Re-enables optimization flag -O in 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

@kg kg merged commit 507f50e into dotnet:main Aug 12, 2025
140 of 143 checks passed
kg added a commit that referenced this pull request Aug 15, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crossgen2 composite with JitOptimization causes R2R dump failures on linux

2 participants