Wasm: store function_count on the ImportSection

This commit is contained in:
Brian Carroll 2022-01-12 08:45:24 +00:00
parent 7a4593170c
commit ca2597973e
3 changed files with 25 additions and 8 deletions

View file

@ -96,8 +96,7 @@ pub fn build_module_help<'a>(
let initial_module = WasmModule::preload(env.arena, preload_bytes);
// Adjust Wasm function indices to account for functions from the object file
let runtime_import_fn_count: u32 = initial_module.import.function_count(); // to be imported at runtime (e.g. WASI)
let fn_index_offset: u32 = runtime_import_fn_count + initial_module.code.preloaded_count;
let fn_index_offset: u32 = initial_module.import.function_count + initial_module.code.preloaded_count;
// Get a map of name to index for the preloaded functions
// Assumes the preloaded object file has all symbols exported, as per `zig build-lib -dymamic`