Uh oh!
There was an error while loading. Please reload this page.
Add support for host callback to get information for platform-native composite R2R images - #121363
Conversation
Uh oh!
There was an error while loading. Please reload this page.
jkoritzinsky
commented
Nov 5, 2025
cc: @adamperlin |
elinor-fung
commented
Nov 6, 2025
This should be ready for review now. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for platform-native R2R (ReadyToRun) composite image loading, enabling the runtime to load composite R2R images in native platform formats (e.g., Mach-O on macOS, PE on Windows) through a new host contract callback mechanism.
Key changes:
- New host contract callback
get_native_code_datato retrieve platform-native composite images from the host - New
READYTORUN_FLAG_PLATFORM_NATIVE_IMAGEflag to mark component assemblies - Test infrastructure to validate platform-native R2R composite image loading
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/corehost/host_runtime_contract.h | Adds new structs and callback interface for native code data retrieval |
| src/installer/tests/Assets/Projects/HostApiInvokerApp/HostRuntimeContract.cs | Updates managed representation of host contract with new callback |
| src/coreclr/inc/readytorun.h | Defines new READYTORUN_FLAG_PLATFORM_NATIVE_IMAGE flag |
| src/coreclr/inc/hostinformation.h | Declares GetNativeCodeData helper method |
| src/coreclr/vm/hostinformation.cpp | Implements GetNativeCodeData to call host callback |
| src/coreclr/vm/readytoruninfo.cpp | Passes platform-native flag when loading composite images |
| src/coreclr/vm/assemblybinder.h | Adds isPlatformNative parameter to LoadNativeImage |
| src/coreclr/vm/assemblybinder.cpp | Simplifies LoadNativeImage and passes isPlatformNative flag |
| src/coreclr/vm/nativeimage.h | Updates Open signature with componentModulePath and isPlatformNative |
| src/coreclr/vm/nativeimage.cpp | Refactors to support both host callback and PE-based loading paths |
| src/coreclr/hosts/corerun/corerun.hpp | Adds platform-specific helpers for UTF-8 conversion and image introspection |
| src/coreclr/hosts/corerun/corerun.cpp | Implements get_native_code_data callback for testing |
| src/tests/Loader/PlatformNativeR2R/PlatformNativeR2R.csproj | Test project configuration |
| src/tests/Loader/PlatformNativeR2R/PlatformNativeR2R.cs | Test implementation using R2RDump validation |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
elinor-fung
commented
Nov 11, 2025
/ba-g Android timeouts |
Depends on #120777. (First commit is a merge from that PR)
Add the basic runtime flow for calling into the host to get information about a platform-native R2R - see ReadyToRun Platform Native Envelope.
get_native_code_datacallback tohost_runtime_contractREADYTORUN_FLAG_PLATFORM_NATIVE_IMAGE, invoke the callback to get the R2R header, image size, and image base addressContributes to #120065.