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.
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:
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.