872: Pass llvm debug flags to the llvm backend. r=nlewycky a=nlewycky

This was accidentally removed in 124ad73e8a .

Co-authored-by: Nick Lewycky <nick@wasmer.io>
This commit is contained in:
bors[bot]
2019-10-08 19:30:46 +00:00
committed by GitHub

View File

@@ -23,7 +23,7 @@ use structopt::StructOpt;
use wasmer::*; use wasmer::*;
use wasmer_clif_backend::CraneliftCompiler; use wasmer_clif_backend::CraneliftCompiler;
#[cfg(feature = "backend-llvm")] #[cfg(feature = "backend-llvm")]
use wasmer_llvm_backend::LLVMCompiler; use wasmer_llvm_backend::{LLVMCompiler, LLVMOptions};
use wasmer_runtime::{ use wasmer_runtime::{
cache::{Cache as BaseCache, FileSystemCache, WasmHash}, cache::{Cache as BaseCache, FileSystemCache, WasmHash},
Func, Value, VERSION, Func, Value, VERSION,
@@ -109,7 +109,7 @@ pub struct LLVMCLIOptions {
post_opt_ir: Option<PathBuf>, post_opt_ir: Option<PathBuf>,
/// Emit LLVM generated native code object file. /// Emit LLVM generated native code object file.
#[structopt(long = "backend-llvm-object-file", parse(from_os_str))] #[structopt(long = "llvm-object-file", parse(from_os_str))]
obj_file: Option<PathBuf>, obj_file: Option<PathBuf>,
} }
@@ -405,6 +405,20 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
None => return Err("the requested backend is not enabled".into()), None => return Err("the requested backend is not enabled".into()),
}; };
#[cfg(feature = "backend-llvm")]
{
if options.backend == Backend::LLVM {
let options = options.backend_llvm_options.clone();
unsafe {
wasmer_llvm_backend::GLOBAL_OPTIONS = LLVMOptions {
pre_opt_ir: options.pre_opt_ir,
post_opt_ir: options.post_opt_ir,
obj_file: options.obj_file,
}
}
}
}
let track_state = !options.no_track_state; let track_state = !options.no_track_state;
#[cfg(feature = "loader-kernel")] #[cfg(feature = "loader-kernel")]