mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-24 09:19:25 +00:00
Change load_object_file to take a callback that converts symbol names into relocation targets.
This change means that load_object_file no longer needs a ModuleInfo, which trampoline generation doesn't have.
This commit is contained in:
@ -30,7 +30,7 @@ use wasm_common::{
|
||||
use wasmer_compiler::wasmparser::{self, BinaryReader, MemoryImmediate, Operator};
|
||||
use wasmer_compiler::{
|
||||
to_wasm_error, wasm_unsupported, CompileError, CompiledFunction, CustomSections,
|
||||
FunctionBodyData, WasmResult,
|
||||
FunctionBodyData, RelocationTarget, WasmResult,
|
||||
};
|
||||
use wasmer_runtime::{MemoryPlan, ModuleInfo, TablePlan, VMBuiltinFunctionIndex, VMOffsets};
|
||||
|
||||
@ -279,9 +279,20 @@ impl FuncTranslator {
|
||||
load_object_file(
|
||||
mem_buf_slice,
|
||||
".wasmer_function",
|
||||
local_func_index,
|
||||
func_names,
|
||||
wasm_module,
|
||||
*local_func_index,
|
||||
|name: &String| {
|
||||
if let Some((index, _)) = func_names
|
||||
.iter()
|
||||
.find(|(_, func_name)| **func_name == *name)
|
||||
{
|
||||
let local_index = wasm_module
|
||||
.local_func_index(index)
|
||||
.expect("relocation to non-local function");
|
||||
Ok(Some(RelocationTarget::LocalFunc(local_index)))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user