crossgen2: Add --rtr-header-symbol-name opt-in option for custom ReadyToRun header symbol#126515
Merged
jkoritzinsky merged 4 commits intomainfrom Apr 6, 2026
Merged
Conversation
…n header symbol name Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/861662d6-3208-41e7-a555-c9e87de7181f Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jkoritzinsky
April 3, 2026 20:55
View session
Member
|
@rolfbjarne this PR implements the ability to specify the R2R symbol name so dotnet/macios won't have to rewrite the symbol names to support multiple R2R images. |
jkoritzinsky
approved these changes
Apr 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in crossgen2 command-line option to override the exported ReadyToRun header symbol name (default RTR_HEADER) for composite builds, and plumbs that setting through to the R2R object writer and symbol naming.
Changes:
- Introduces
--rtr-header-symbol-name <name>and validates it requires--composite. - Adds
CompositeImageSettings.ReadyToRunHeaderSymbolNameto carry the value through compilation. - Uses the setting when naming the R2R header symbol and when exporting the PE symbol.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs | Uses CompositeImageSettings.ReadyToRunHeaderSymbolName as the alternate symbol name for the R2R header. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/CompositeImageSettings.cs | Adds a field to carry the custom header symbol name through the pipeline. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs | Exports the configured header symbol name (PE composite build). |
| src/coreclr/tools/aot/crossgen2/Properties/Resources.resx | Adds option help text and a new error string. |
| src/coreclr/tools/aot/crossgen2/Program.cs | Parses/validates the new option and sets it on CompositeImageSettings. |
| src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs | Registers the new --rtr-header-symbol-name option. |
.../tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs
Outdated
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs
Outdated
Show resolved
Hide resolved
Member
|
@copilot please address the feedback |
… and PE format, fix IsNullOrEmpty fallbacks Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/66091b3b-2d80-4df7-bf1a-1a5bb3944465 Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Contributor
Author
Done in 3665b44. The three review items are addressed:
|
This was referenced Apr 4, 2026
…e in R2R docs Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/53565a7b-a2b2-4e0b-8a66-ea67cc354f8c Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
jkoritzinsky
reviewed
Apr 4, 2026
docs/design/coreclr/botr/readytorun-platform-native-envelope.md
Outdated
Show resolved
Hide resolved
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/874de5dc-b706-4578-8581-2385601704ab Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
jkoritzinsky
approved these changes
Apr 5, 2026
Member
|
/ba-g build analysis stuck and all lanes green |
radekdoulik
pushed a commit
to radekdoulik/runtime
that referenced
this pull request
Apr 9, 2026
…yToRun header symbol (dotnet#126515) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds an opt-in
crossgen2command-line option--rtr-header-symbol-nameto override the exported ReadyToRun header symbol name (default:RTR_HEADER) for composite builds. This supports custom hosts that directly link against multiple R2R images — rather than loading them dynamically viadlopenor equivalent — where each image needs a distinct export symbol name to avoid collisions.Code changes
--rtr-header-symbol-name <name>incrossgen2, validated to require--compositeand to be non-empty/non-whitespace. Works with both PE and Mach-O output formats (Mach-O is the primary scenario).CompositeImageSettings.ReadyToRunHeaderSymbolNameto carry the value through compilation.GetSymbolAlternateNamein the baseObjectWriter, which applies to all object format writers (PE and Mach-O).PEObjectWriter.AddExportedSymbol.string.IsNullOrEmpty/string.IsNullOrWhiteSpacefallback guards to"RTR_HEADER"inReadyToRunCodegenNodeFactoryandReadyToRunObjectWriterto prevent empty/invalid symbol names.Documentation changes
readytorun-format.md: notesRTR_HEADERis customizable via--rtr-header-symbol-name; adds explanation of the custom-host use case in the Structures section.readytorun-platform-native-envelope.md: notes the symbol name is customizable in the bullet list; adds a dedicated "Customizing the RTR_HEADER symbol name" subsection (without redundant--compositeor format constraints, since composite is always required in this context and Mach-O is the primary scenario).readytorun-composite-format-design.md: notesRTR_HEADERcustomizability in both relevant locations.