Add R2R knob to force value of TargetAllowsRuntimeCodeGeneration - #132889
Open
BrzVlad wants to merge 1 commit into
Open
Add R2R knob to force value of TargetAllowsRuntimeCodeGeneration#132889BrzVlad wants to merge 1 commit into
BrzVlad wants to merge 1 commit into
Conversation
iOS like configuration can be obtained by passing `--target-allows-runtime-code-generation:false`
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an explicit crossgen2 command-line knob to override the inferred TargetAllowsRuntimeCodeGeneration value, and wires it into the CoreCLR corelib crossgen invocation so that builds with FeatureDynamicCodeCompiled=false produce matching ReadyToRun behavior.
Changes:
- Add
--target-allows-runtime-code-generationoption to crossgen2 (nullable bool override). - Use the override (when provided) instead of the target OS/arch heuristic in crossgen2 compilation setup.
- Pass the knob from
crossgen-corelib.projbased on$(FeatureDynamicCodeCompiled)so corelib R2R generation matches the runtime configuration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/tools/aot/crossgen2/Properties/Resources.resx | Adds the help/description string for the new CLI option. |
| src/coreclr/tools/aot/crossgen2/Program.cs | Applies the option override and feeds it into ReadyToRun compilation behavior and context construction. |
| src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs | Declares and registers the new --target-allows-runtime-code-generation option. |
| src/coreclr/crossgen-corelib.proj | Propagates $(FeatureDynamicCodeCompiled) into crossgen2 via the new option. |
jkotas
reviewed
Aug 28, 2026
| <value>Target architecture for cross compilation</value> | ||
| </data> | ||
| <data name="TargetAllowsRuntimeCodeGenerationOption" xml:space="preserve"> | ||
| <value>Whether the target supports runtime code generation</value> |
Member
There was a problem hiding this comment.
Suggested change
| <value>Whether the target supports runtime code generation</value> | |
| <value>Override whether the target allows runtime code generation</value> |
Starting the description with "Whether" seems inconsistent with other descriptions
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.
iOS like configuration can be obtained by passing
--target-allows-runtime-code-generation:false.When runtime is built with
dynamiccodecompiledfalse, this also makes sure that corelib is build in this configuration, just to make sure that corerun and testhost respect it. We don't yet test this configuration on CI, so no additional changes are done yet on the testing infra.dotnet/performancejob expected crossgen2 built from runtime withdynamiccodecompiledto haveTargetAllowsRuntimeCodeGenerationautomatically disabled. This regressed following the removal of theFEATURE_DYNAMIC_CODE_COMPILEDhack in https://github.com/dotnet/runtime/pull/130622/changes.