Add support for host callback to get information for platform-native composite R2R images#121363
Merged
elinor-fung merged 12 commits intodotnet:mainfrom Nov 11, 2025
Merged
Conversation
This was referenced Nov 5, 2025
Open
am11
reviewed
Nov 5, 2025
Member
|
cc: @adamperlin |
This was referenced Nov 6, 2025
Member
Author
|
This should be ready for review now. |
Contributor
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 |
jkoritzinsky
approved these changes
Nov 6, 2025
Co-authored-by: Copilot <[email protected]>
am11
reviewed
Nov 7, 2025
am11
reviewed
Nov 7, 2025
This was referenced Nov 7, 2025
Co-authored-by: Adeel Mujahid <[email protected]>
Member
Author
|
/ba-g Android timeouts |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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.