Remove memory-related cases from RelocationTarget (#949)
This commit shrinks the `RelocationTarget` enumeration to remove intrinsic-related relocations since they are no longer used. Instead these function calls are done indirectly via a table in the `VMContext`. This means that all of this is essentially dead code!
This commit is contained in:
@@ -5,16 +5,6 @@ use wasmtime_environ::settings;
|
||||
use wasmtime_environ::settings::Configurable;
|
||||
use wasmtime_environ::{Compilation, Module, RelocationTarget, Relocations};
|
||||
|
||||
fn get_reloc_target_special_import_name(target: RelocationTarget) -> Option<&'static str> {
|
||||
Some(match target {
|
||||
RelocationTarget::Memory32Grow => &"wasmtime_memory32_grow",
|
||||
RelocationTarget::ImportedMemory32Grow => &"wasmtime_memory32_grow",
|
||||
RelocationTarget::Memory32Size => &"wasmtime_memory32_size",
|
||||
RelocationTarget::ImportedMemory32Size => &"wasmtime_imported_memory32_size",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Defines module functions
|
||||
pub fn declare_functions(
|
||||
obj: &mut Artifact,
|
||||
@@ -25,14 +15,6 @@ pub fn declare_functions(
|
||||
let string_name = format!("_wasm_function_{}", i);
|
||||
obj.declare(string_name, Decl::function_import())?;
|
||||
}
|
||||
for (_, function_relocs) in relocations.iter() {
|
||||
for r in function_relocs {
|
||||
let special_import_name = get_reloc_target_special_import_name(r.reloc_target);
|
||||
if let Some(special_import_name) = special_import_name {
|
||||
obj.declare(special_import_name, Decl::function_import())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i, _function_relocs) in relocations.iter().rev() {
|
||||
let func_index = module.func_index(i);
|
||||
let string_name = format!("_wasm_function_{}", func_index.index());
|
||||
@@ -81,16 +63,6 @@ pub fn emit_functions(
|
||||
at: r.offset as u64,
|
||||
})?;
|
||||
}
|
||||
RelocationTarget::Memory32Grow
|
||||
| RelocationTarget::ImportedMemory32Grow
|
||||
| RelocationTarget::Memory32Size
|
||||
| RelocationTarget::ImportedMemory32Size => {
|
||||
obj.link(Link {
|
||||
from: &string_name,
|
||||
to: get_reloc_target_special_import_name(r.reloc_target).expect("name"),
|
||||
at: r.offset as u64,
|
||||
})?;
|
||||
}
|
||||
RelocationTarget::JumpTable(_, _) => {
|
||||
// ignore relocations for jump tables
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user