Process declared element segments for "possibly exported funcs" (#2851)

Now that we're using "possibly exported" as an impactful decision for
codegen (which trampolines to generate and which ABI a function has)
it's important that we calculate this property of a wasm function
correctly! Previously Wasmtime forgot to processed "declared" elements
in apart from active/passive element segments, but this updates Wasmtime
to ensure that these entries are processed and all the functions
contained within are flagged as "possibly exported".

Closes #2850
This commit is contained in:
Alex Crichton
2021-04-20 16:52:51 -05:00
committed by GitHub
parent 200d7f1df6
commit 196bcec6cf
4 changed files with 42 additions and 1 deletions

View File

@@ -746,6 +746,13 @@ impl<'data> cranelift_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data
Ok(())
}
fn declare_elements(&mut self, segments: Box<[FuncIndex]>) -> WasmResult<()> {
for element in segments.iter() {
self.flag_func_possibly_exported(*element);
}
Ok(())
}
fn reserve_function_bodies(&mut self, _count: u32, offset: u64) {
self.result.debuginfo.wasm_file.code_section_offset = offset;
}