Files
wasmtime/cranelift/fuzz/fuzz_translate_module.rs
Dan Gohman 4e67e08efd Use the target-lexicon crate.
This switches from a custom list of architectures to use the
target-lexicon crate.

 - "set is_64bit=1; isa x86" is replaced with "target x86_64", and
   similar for other architectures, and the `is_64bit` flag is removed
   entirely.

 - The `is_compressed` flag is removed too; it's no longer being used to
   control REX prefixes on x86-64, ARM and Thumb are separate
   architectures in target-lexicon, and we can figure out how to
   select RISC-V compressed encodings when we're ready.
2018-05-30 06:13:35 -07:00

19 lines
510 B
Rust

#![no_main]
#[macro_use]
extern crate libfuzzer_sys;
extern crate binaryen;
extern crate cretonne_wasm;
#[macro_use]
extern crate target_lexicon;
use cretonne_wasm::{translate_module, DummyEnvironment};
use std::str::FromStr;
fuzz_target!(|data: &[u8]| {
let binaryen_module = binaryen::tools::translate_to_fuzz_mvp(data);
let wasm = binaryen_module.write();
let mut dummy_environ = DummyEnvironment::with_triple(triple!("x86_64"));
translate_module(&wasm, &mut dummy_environ).unwrap();
});