[wasm][R2R] Request flat layout for composite image on WebAssembly#131354
Open
lewing wants to merge 1 commit into
Open
[wasm][R2R] Request flat layout for composite image on WebAssembly#131354lewing wants to merge 1 commit into
lewing wants to merge 1 commit into
Conversation
OpenR2RFromPE requested PEImageLayout::LAYOUT_LOADED for the composite R2R container. On WebAssembly (PEIMAGE_FLAT_LAYOUT_ONLY) there is no OS-loadable mapped layout, so the loaded-layout branch in GetOrCreateLayoutInternal is compiled out and the request degrades to nothing, tripping the _ASSERTE(bIsFlatLayoutSuitable) consistency check in Debug builds (and only silently degrading in Release). Every other wasm image open uses LAYOUT_ANY. Request LAYOUT_FLAT explicitly on TARGET_WASM so a webcil composite loads via the flat layout, matching the rest of the wasm image-load paths. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 50ddfb2c-b6f8-4847-81e7-44d37d44a175
|
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
Updates CoreCLR’s composite R2R loading path on WebAssembly to request a flat PE layout explicitly when opening the composite image, avoiding a debug assert caused by requesting a loaded/mapped layout on a flat-only platform.
Changes:
- Under
TARGET_WASM, callPEImage::GetOrCreateLayout(PEImageLayout::LAYOUT_FLAT)instead ofLAYOUT_LOADEDwhen opening the composite image. - Add in-code rationale explaining why the flat layout is required on WASM for webcil composites.
Comment on lines
+141
to
+148
| #ifdef TARGET_WASM | ||
| // WebAssembly is flat-layout only (PEIMAGE_FLAT_LAYOUT_ONLY): a webcil composite has no | ||
| // OS-loadable/mapped layout, so requesting LAYOUT_LOADED yields no layout and trips the | ||
| // flat-suitability assert in GetOrCreateLayoutInternal. Request the flat layout explicitly. | ||
| PEImageLayout* loaded = pImage->GetOrCreateLayout(PEImageLayout::LAYOUT_FLAT); | ||
| #else | ||
| PEImageLayout* loaded = pImage->GetOrCreateLayout(PEImageLayout::LAYOUT_LOADED); | ||
| #endif // TARGET_WASM |
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
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.
On WebAssembly, PE images are flat-layout only (
PEIMAGE_FLAT_LAYOUT_ONLY). A webcil composite R2R image has no OS-loadable/mapped layout, so requestingLAYOUT_LOADEDyields no layout and trips the flat-suitability assert inGetOrCreateLayoutInternal. Request the flat layout explicitly underTARGET_WASMwhen obtaining the composite image layout inNativeImage::Open.Guarded by
#ifdef TARGET_WASM, so no behavior change on any other target.Note
This pull request was authored with assistance from GitHub Copilot.