Skip to content

[wasm] Package CoreCLR native symbol map - #134010

Draft
lewing wants to merge 1 commit into
mainfrom
lewing-native-wasm-profiler-symbols
Draft

lewing wants to merge 1 commit into
mainfrom
lewing-native-wasm-profiler-symbols

Conversation

@lewing

@lewing lewing commented Sep 15, 2026

Copy link
Copy Markdown
Member

CoreCLR browser builds already generate Emscripten's dotnet.native.js.symbols, but the browser runtime .nupkg did not contain it. This adds the existing file to the CoreCLR runtime-pack harvest, matching Mono, so WasmEmitSymbolMap=true can publish native symbols without forcing an application relink.

The Emscripten index:name payload remains unchanged. The boot resource model now retains the symbols file's SHA-256 alongside the existing final-wasm SHA-256, so fingerprinted published files can be discovered and verified as an exact pair.

Validation includes an independent WebAssembly import/function/code/export parser and Emscripten-map parser. It verifies absolute module function indices include imports, checks runtime/interpreter/libc/exported/compiler-generated anchors, and rejects shifted indices, stale wasm identity, and mutated symbol-map bytes.

Current Release artifacts:

Artifact Size SHA-256
dotnet.native.wasm 4,698,251 bytes 4abe2a6ca7e5cc5f8bc674d0a111e7e3e3ed1f78cc2c28a0387d74b8ce22fd04
dotnet.native.js.symbols 655,281 bytes 19b6b201a88b019db6b822a2baf3e5a8022f54ef4e385633b931255e80b1ef4b

The runtime .nupkg grew from 71,838,978 to 71,984,589 bytes (+145,611 bytes, 0.20%). Application publish remains opt-in through WasmEmitSymbolMap.

Live Chrome/CDP cross-check:

  • V8 stopped at absolute function index 9614, resolved by the map as BrowserHost_ExecuteAssembly.
  • V8 then stopped at stripped $func2243; the map resolves index 2243 to InterpExecMethod(InterpreterFrame*, InterpMethodContextFrame*, InterpThreadContext*, ExceptionClauseArgs*).
  • Its stripped caller $func2276 resolves to ExecuteInterpretedMethod.

R2R transition thunks are functions in separately loaded Webcil modules and remain covered by their module-local name sections from #132906; they are intentionally not folded into this native-host map.

Validation run:

  • PATH=/opt/homebrew/bin:$PATH ./build.sh -os browser -c Release -subset clr+libs
  • Wasm.Build.Tests.ModuleConfigTests.RuntimePackSymbolMapMatchesFinalWasm — 1 passed
  • Wasm.Build.Tests.ModuleConfigTests.RuntimePackSymbolMapRejectsIndexAndIdentityMismatches — 1 passed
  • Wasm.Build.Tests.ModuleConfigTests.SymbolMapFileEmitted — build and publish cases passed, including fingerprinted static assets
  • Wasm.Build.Tests.ModuleConfigTests.SymbolMapFileNotEmitted — build and publish opt-out cases passed

Resolves #134009

Note

This pull request was generated by GitHub Copilot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Build-mono

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package CoreCLR browser WebAssembly native symbol map

1 participant