Fuzz-code-coverage motivated improvements (#3905)
* fuzz: Fuzz padding between compiled functions This commit hooks up the custom `wasmtime_linkopt_padding_between_functions` configuration option to the cranelift compiler into the fuzz configuration, enabling us to ensure that randomly inserting a moderate amount of padding between functions shouldn't tamper with any results. * fuzz: Fuzz the `Config::generate_address_map` option This commit adds fuzz configuration where `generate_address_map` is either enabled or disabled, unlike how it's always enabled for fuzzing today. * Remove unnecessary handling of relocations This commit removes a number of bits and pieces all related to handling relocations in JIT code generated by Wasmtime. None of this is necessary nowadays that the "old backend" has been removed (quite some time ago) and relocations are no longer expected to be in the JIT code at all. Additionally with the minimum x86_64 features required to run wasm code it should be expected that no libcalls are required either for Wasmtime-based JIT code.
This commit is contained in:
@@ -547,36 +547,22 @@ impl Compiler {
|
||||
isa: &dyn TargetIsa,
|
||||
) -> Result<CompiledFunction, CompileError> {
|
||||
let mut code_buf = Vec::new();
|
||||
let mut relocs = Vec::new();
|
||||
context
|
||||
.compile_and_emit(isa, &mut code_buf)
|
||||
.map_err(|error| CompileError::Codegen(pretty_error(&context.func, error)))?;
|
||||
|
||||
for &MachReloc {
|
||||
offset,
|
||||
srcloc: _,
|
||||
kind,
|
||||
ref name,
|
||||
addend,
|
||||
} in context
|
||||
// Processing relocations isn't the hardest thing in the world here but
|
||||
// no trampoline should currently generate a relocation, so assert that
|
||||
// they're all empty and if this ever trips in the future then handling
|
||||
// will need to be added here to ensure they make their way into the
|
||||
// `CompiledFunction` below.
|
||||
assert!(context
|
||||
.mach_compile_result
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.buffer
|
||||
.relocs()
|
||||
{
|
||||
let reloc_target = if let ir::ExternalName::LibCall(libcall) = *name {
|
||||
RelocationTarget::LibCall(libcall)
|
||||
} else {
|
||||
panic!("unrecognized external name")
|
||||
};
|
||||
relocs.push(Relocation {
|
||||
reloc: kind,
|
||||
reloc_target,
|
||||
offset,
|
||||
addend,
|
||||
});
|
||||
}
|
||||
.is_empty());
|
||||
|
||||
let unwind_info = context
|
||||
.create_unwind_info(isa)
|
||||
@@ -585,7 +571,7 @@ impl Compiler {
|
||||
Ok(CompiledFunction {
|
||||
body: code_buf,
|
||||
unwind_info,
|
||||
relocations: relocs,
|
||||
relocations: Vec::new(),
|
||||
stack_slots: Default::default(),
|
||||
value_labels_ranges: Default::default(),
|
||||
info: Default::default(),
|
||||
|
||||
Reference in New Issue
Block a user