The llvm compiler uses ELF under the hood, attempt to convert any Target to the same thing, but with ELF.

This commit is contained in:
Nick Lewycky
2020-05-12 16:34:58 -07:00
parent 3a991a7f59
commit 613e40ed79

View File

@@ -8,7 +8,7 @@ use inkwell::targets::{
use inkwell::OptimizationLevel;
use itertools::Itertools;
use target_lexicon::Architecture;
use wasmer_compiler::{Compiler, CompilerConfig, CpuFeature, Features, Target};
use wasmer_compiler::{Compiler, CompilerConfig, CpuFeature, Features, Target, Triple};
/// The InkWell Module type
pub type InkwellModule<'ctx> = inkwell::module::Module<'ctx>;
@@ -47,6 +47,14 @@ impl LLVMConfig {
/// Creates a new configuration object with the default configuration
/// specified.
pub fn new(features: Features, target: Target) -> Self {
let triple = Triple {
architecture: target.triple().architecture,
vendor: target.triple().vendor.clone(),
operating_system: target.triple().operating_system,
environment: target.triple().environment,
binary_format: target_lexicon::BinaryFormat::Elf,
};
let target = Target::new(triple, *target.cpu_features());
Self {
enable_nan_canonicalization: true,
enable_verifier: false,