Migrating code to object (from faerie) (#1848)

* Using the "object" library everywhere in wasmtime.
* scroll_derive
This commit is contained in:
Yury Delendik
2020-06-10 11:27:00 -05:00
committed by GitHub
parent 5d01603390
commit e5b81bbc28
13 changed files with 166 additions and 77 deletions

View File

@@ -5,6 +5,7 @@ use crate::{init_file_per_thread_logger, pick_compilation_strategy, CommonOption
use anyhow::{anyhow, Context as _, Result};
use std::{
fs::File,
io::Write,
path::{Path, PathBuf},
str::FromStr,
};
@@ -75,13 +76,13 @@ impl WasmToObjCommand {
self.common.enable_simd,
self.common.opt_level(),
self.common.debug_info,
self.output.clone(),
&cache_config,
)?;
// FIXME: Make the format a parameter.
let file = File::create(Path::new(&self.output)).context("failed to create object file")?;
obj.write(file).context("failed to write object file")?;
let mut file =
File::create(Path::new(&self.output)).context("failed to create object file")?;
file.write_all(&obj.write()?)
.context("failed to write object file")?;
Ok(())
}