Skip to content

Add --strip-il-bodies crossgen2 arg for Apple mobile RIDs#53947

Merged
kotlarmilos merged 4 commits intodotnet:mainfrom
kotlarmilos:r2r-strip-il-bodies-apple-rids
Apr 28, 2026
Merged

Add --strip-il-bodies crossgen2 arg for Apple mobile RIDs#53947
kotlarmilos merged 4 commits intodotnet:mainfrom
kotlarmilos:r2r-strip-il-bodies-apple-rids

Conversation

@kotlarmilos
Copy link
Copy Markdown
Member

@kotlarmilos kotlarmilos commented Apr 17, 2026

Description

Mirror the changes from dotnet/runtime#125647.

For Apple mobile RIDs (ios-, tvos-, iossimulator-, tvossimulator-, maccatalyst-), pass --strip-il-bodies to crossgen2 by default via PublishReadyToRunCrossgen2ExtraArgs when composite R2R is enabled (PublishReadyToRunComposite=true), controllable via the PublishReadyToRunStripILBodies MSBuild property. The composite gate is required because crossgen2 only accepts --strip-il-bodies in composite mode.

Mirror the changes from dotnet/runtime#125647.

For Apple mobile RIDs (ios-, tvos-, iossimulator-, tvossimulator-,
maccatalyst-), pass --strip-il-bodies to crossgen2 by default via
PublishReadyToRunCrossgen2ExtraArgs when composite R2R is enabled,
controllable via the PublishReadyToRunStripILBodies MSBuild property.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 17, 2026 09:44
Copy link
Copy Markdown
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

Updates the SDK’s ReadyToRun crossgen2 invocation defaults for Apple mobile RuntimeIdentifiers to match dotnet/runtime behavior, enabling IL body stripping when composite ReadyToRun compilation is used.

Changes:

  • Append --strip-il-bodies to PublishReadyToRunCrossgen2ExtraArgs for ios-, tvos-, iossimulator-, tvossimulator-, and maccatalyst- RIDs.
  • Gate the new flag on PublishReadyToRunComposite=true (since crossgen2 only accepts it in composite mode) and allow opt-out via PublishReadyToRunStripILBodies=false.

Comment thread src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets Outdated
Copy link
Copy Markdown
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this interact with the partial R2R functionality?

We may need to limit this to non-partial R2R compilations (so make it another parameter on RunReadyToRunCompiler and dynamically add it in the correct cases).

Address review feedback: instead of injecting --strip-il-bodies via
PublishReadyToRunCrossgen2ExtraArgs (which applies to every crossgen2
invocation, including per-assembly partial R2R compilations batched
through the same target), expose a new Crossgen2CompositeExtraCommandLineArgs
parameter on the RunReadyToRunCompiler task and append it only when the
CompilationEntry is the composite build entry (CreateCompositeImage=true
and PartialCompile=false).

Also skip the flag when PublishReadyToRunPartialAssemblies or
PublishReadyToRunCompositeExclusions are specified, since those
scenarios leave some methods IL-only and need the IL bodies at runtime.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos
Copy link
Copy Markdown
Member Author

@jkoritzinsky Introduced PublishReadyToRunCrossgen2CompositeExtraArgs to gate on full composite R2R compilation

Comment thread src/Tasks/Microsoft.NET.Build.Tasks/RunReadyToRunCompiler.cs Outdated
Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
@kotlarmilos
Copy link
Copy Markdown
Member Author

/ba-g windows jobs ran longer than the maximum time of 150 minutes

@kotlarmilos kotlarmilos merged commit 1ec3763 into dotnet:main Apr 28, 2026
16 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants