diff --git a/.travis.yml b/.travis.yml index e73e9933976..548230651cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,3 +21,6 @@ env: - RUST_BACKTRACE=1 # Reduce amount of benchmark runs as they are slow. - COMPILE_RUNS=2 RUN_RUNS=2 + CG_CLIF_COMPILE_FLAGS: + - "" + - "--features backend_object" diff --git a/Cargo.toml b/Cargo.toml index 0da280f24e2..86347a006d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,14 +10,14 @@ edition = "2018" crate-type = ["dylib"] [features] -backend_object = ["object/write"] +backend_object = ["object/write", "cranelift-object"] [dependencies] # These have to be in sync with each other cranelift = { git = "https://github.com/CraneStation/cranelift.git" } cranelift-module = { git = "https://github.com/CraneStation/cranelift.git" } cranelift-faerie = { git = "https://github.com/CraneStation/cranelift.git" } -cranelift-object = { git = "https://github.com/CraneStation/cranelift.git" } +cranelift-object = { git = "https://github.com/CraneStation/cranelift.git", optional = true } target-lexicon = "0.8.1" faerie = "0.11.0" diff --git a/src/backend.rs b/src/backend.rs index 60cf43da1b9..94b1cd7d583 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -5,9 +5,13 @@ use rustc::session::Session; use cranelift_module::{FuncId, Module}; use faerie::*; +#[cfg(feature = "backend_object")] use object::{SectionKind, RelocationKind, RelocationEncoding}; +#[cfg(feature = "backend_object")] use object::write::*; use cranelift_faerie::{FaerieBackend, FaerieBuilder, FaerieProduct, FaerieTrapCollection}; + +#[cfg(feature = "backend_object")] use cranelift_object::*; use gimli::SectionId; @@ -41,6 +45,7 @@ impl WriteMetadata for faerie::Artifact { } } +#[cfg(feature = "backend_object")] impl WriteMetadata for object::write::Object { fn add_rustc_section(&mut self, symbol_name: String, data: Vec, _is_like_osx: bool) { let segment = self.segment_name(object::write::StandardSegment::Data).to_vec(); @@ -108,6 +113,7 @@ impl WriteDebugInfo for FaerieProduct { } } +#[cfg(feature = "backend_object")] impl WriteDebugInfo for ObjectProduct { type SectionId = (object::write::SectionId, object::write::SymbolId); @@ -158,6 +164,7 @@ impl Emit for FaerieProduct { } } +#[cfg(feature = "backend_object")] impl Emit for ObjectProduct { fn emit(self) -> Vec { self.object.write().unwrap()