Wasm NativeAOT: Add WASM_GLOBAL_INDEX_LEB relocation support + WasmNativeObjectWriter scaffold#90
Draft
Copilot wants to merge 3 commits into
Draft
Wasm NativeAOT: Add WASM_GLOBAL_INDEX_LEB relocation support + WasmNativeObjectWriter scaffold#90Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Reconstruct wasm NativeAOT object writer from session logs
[wasm] Reconstruct NativeAOT WebAssembly object writer bring-up branch
Jun 11, 2026
… scaffold Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com>
Copilot
AI
changed the title
[wasm] Reconstruct NativeAOT WebAssembly object writer bring-up branch
Wasm NativeAOT: Add WASM_GLOBAL_INDEX_LEB relocation support + WasmNativeObjectWriter scaffold
Jun 12, 2026
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.
Wires in
WASM_GLOBAL_INDEX_LEBrelocation handling for the R2R Webcil path and lays the groundwork for a NativeAOT relocatable wasm object writer.R2R (
WasmObjectWriter.cs)_definedSymbols[reloc.SymbolName]toTryGetValue— avoidsKeyNotFoundExceptionfor non-ObjectNodesymbols (e.g.WasmBaseGlobalSymbolNode) that are never added to_definedSymbolsWASM_GLOBAL_INDEX_LEBcase: maps__stack_pointer→ 0,__memory_base→ 1,__table_base→ 2 (matching_defaultGlobalImportsfixed positions)WasmInstructions.csGlobal.Get(ISymbolNode)/Global.Set(ISymbolNode)overloads usingWasmLEBConstantReloc(..., WASM_GLOBAL_INDEX_LEB)— enables future code to reference base globals by symbol rather than hardcoded indexNativeAOT wasm writer scaffold
WasmNativeObjectWriter.cs(new,Common/): skeleton for a relocatable wasm object writer (wasm magic/version header; all section/debug/unwind methods stubbed TODO-Wasm)ObjectWriter.cs: addedstatic partial void TryCreateArchitectureSpecificWriter(...)hook using the existing partial method patternObjectWriter.Aot.cs: implements the hook to dispatch toWasmNativeObjectWriterforTargetArchitecture.Wasm32Project files
WasmBaseGlobalSymbolNode.csadded to bothILCompiler.ReadyToRun.csprojandILCompiler.Compiler.csprojWasmAbiConstants.csandWasmNativeObjectWriter.csadded toILCompiler.Compiler.csproj