Skip to content

[RyuJit Wasm] Emit relocations for WebCIL globals rather than hardcoding global table indices #129712

Description

@jtschuster

Global indices for imageBase, tableBase, and stackPointer as hard-coded into the generated code, which is incompatible with Native AOT. Instead, the JIT should emit relocations for the values for crossgen2 and nativeaot to fill in.

One way to do this would be a new JIT-EE api:

typedef struct CORINFO_WASM_GLOBAL_SYMBOL_STRUCT_* CORINFO_WASM_GLOBAL_SYMBOL_HANDLE;

struct CORINFO_WASM_BASE_GLOBALS
{
    CORINFO_WASM_GLOBAL_SYMBOL_HANDLE stackPointer;
    CORINFO_WASM_GLOBAL_SYMBOL_HANDLE imageBase;
    CORINFO_WASM_GLOBAL_SYMBOL_HANDLE tableBase;
};

void getWasmBaseGlobals(CORINFO_WASM_BASE_GLOBALS* pBaseGlobals);

The crossgen2 and nativeaot object writers would then fixup the relocation according the target (WebCIL or Relocatable WASM object).

Alternatively, these could be implemented as ReadyToRun helpers.

Activity

  1. added this to the 11.0.0 milestone on Jun 22, 2026
  2. self-assigned this
    on Jun 22, 2026
  3. added
    arch-wasmWebAssembly architecture
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Jun 22, 2026
  4. dotnet-policy-service commented on Jun 22, 2026

    @dotnet-policy-service
    Contributor

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

  5. dotnet-policy-service commented on Jun 22, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  6. added a commit that references this issue on Jul 18, 2026
    6593571
  7. locked and limited conversation to collaborators on Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions