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.

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