Skip to content

WASM/WASI changes to bootstrapper - #135765

Merged
MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:nativeaot-wasm-bootstrap
Oct 14, 2026
Merged

MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:nativeaot-wasm-bootstrap

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Part of a series of pull requests that enable compiling, linking, and running a Console.WriteLine hello world on WASI/native AOT.

Summary

Use the single __Module slot emitted by ModulesSectionNode for Wasm module discovery instead of linker section-boundary symbols. The slot contains the ReadyToRun header pointer, so bootstrap passes its address (&__Module) and a count of one to InitializeModules.

Skip RhRegisterOSModule on Wasm because the current native code-manager/managed-code/unboxing-range registration is not supported there. Type-manager creation, statics, frozen objects, classlib functions, and module initialization remain intact. Other platforms retain their existing discovery/registration paths.

The Wasm path assumes one NativeAOT compilation unit, not one managed assembly; it does not add multi-module or dynamic-linking support.

Validation

  • .\build.cmd clr.nativeaotruntime -rc Checked -os wasi -arch wasm - passed.
  • Focused executable and native-library bootstrap fixtures reproduced the missing section-symbol link failure before the fix; after the fix both linked, passed Wasm validation, and ran successfully.
  • With the complete series, both real-CoreLib Hello variants linked and ran successfully under Wasmtime.

These results are from the combined local bringup tree, including prerequisite NativeAOT/Wasm enablement, not a fresh build of this isolated main-based branch. The bootstrap fixtures are local probes, not tests added by this PR.

Note

This PR description was generated by GitHub Copilot.

There are issues with the __modules_a/__modules_z trick and we don't really need that in practice. Also, skip registering OS module, we can't register managed code/unbox regions anyway.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: c78266f3-08e3-4918-b2e5-9fe0ddf2ca17
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — e5f82459 Deployed Oct 14, 2026 by MichalStrehovsky via conclusion #10354
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-NativeAOT-coreclr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants