Skip to content

Do not emit MethodAssociatedDataNode on WASM - #135762

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

MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:nativeaot-wasm-no-associated-data

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

Make MethodHasAssociatedData return false for Wasm. The current associated-data format attaches metadata to unwind information and emits relative target pointers, which does not fit the Wasm representation.

The observed link failure was an R_WASM_MEMORY_ADDR_LOCREL_I32 relocation targeting a function symbol from an instantiating unboxing stub's associated-data record. A Wasm function pointer is a table index, not a linear-memory-relative address.

This suppresses the unsupported metadata for bringup rather than changing its format or pretending a table index is a relative pointer. A future Wasm-specific metadata mechanism is still needed for consumers that require this information.

Validation

  • .\dotnet.cmd build src\coreclr\tools\aot\ILCompiler\ILCompiler.csproj -c Checked - passed during bringup.
  • Both real-CoreLib Hello objects became readable by LLVM and passed the original invalid-relocation link failure.
  • With the rest of the series, both 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. Associated-data-dependent runtime behavior was not validated.

Note

This PR description was generated by GitHub Copilot.

We can't attach metadata to unwinding info, this will require a different mechanism on WASM. Right now this doesn't link because this node uses relative relocs.

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 — d8637dd8 Deployed Oct 14, 2026 by MichalStrehovsky via conclusion #10348
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