Add support for iOS sample app to publish and run with R2R on coreclr#121824
Add support for iOS sample app to publish and run with R2R on coreclr#121824elinor-fung merged 15 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for publishing and running iOS sample apps with ReadyToRun (R2R) compilation on CoreCLR. The implementation updates the AppleAppBuilder host template to use the new host_runtime_contract API for loading R2R composite images, configures the build system to use in-repo crossgen2 tools with Mach-O format support, and enables code signing for R2R dylib files.
Key changes:
- Implement native code loading callback via
get_native_code_datato support R2R composite images on iOS - Configure build system to use in-build crossgen2 with Mach-O container format for R2R
- Update environment variables to set DOTNET_InterpMode=1 when R2R is enabled
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tasks/AppleAppBuilder/Xcode.cs | Adds host_runtime_contract.h to embedded resources for CoreCLR runtime |
| src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m | Implements host_runtime_contract with native code loading support via dlopen/dlsym for R2R composite images |
| src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template | Adds code signing for *.r2r.dylib files in app bundle |
| src/tasks/AppleAppBuilder/AppleAppBuilder.csproj | Includes host_runtime_contract.h as embedded resource |
| src/mono/sample/iOS/Program.csproj | Configures R2R publishing with composite images and Mach-O format, imports repo crossgen2 targets |
| src/mono/sample/iOS/Makefile | Adds R2R parameter to build-appbundle target |
| src/mono/msbuild/apple/build/AppleBuild.targets | Adds condition to skip AOT when using CoreCLR runtime |
| src/mono/msbuild/apple/build/AppleBuild.InTree.targets | Overrides SDK target to use in-build crossgen2 for R2R compilation |
| src/coreclr/inc/clrconfigvalues.h | Enables ReadyToRun by default for iOS/tvOS/macCatalyst platforms |
kotlarmilos
left a comment
There was a problem hiding this comment.
Could we enable interpreter + R2R in the iOS.Simulator.CoreCLR.Interpreter.Test.csproj functional test in CI? This requires setting the same properties and items used in the sample app.
Edit: kept the InterpMode environment variable in the test, so for now R2R is still disabled in it. I'll revisit separately. |
|
@jkotas @kotlarmilos any outstanding concerns here? |
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
jkotas
left a comment
There was a problem hiding this comment.
The parts that I understand LGTM.
@kotlarmilos should sign-off too.
Runtime:
iOS sample app:
host_runtime_contract*.r2r.dylib