Remove faerie support
This commit is contained in:
parent
2bd7dcd2c0
commit
d65ba25ba7
@ -21,6 +21,3 @@ env:
|
||||
- RUST_BACKTRACE=1
|
||||
# Reduce amount of benchmark runs as they are slow.
|
||||
- COMPILE_RUNS=2 RUN_RUNS=2
|
||||
jobs:
|
||||
- "CG_CLIF_COMPILE_FLAGS="
|
||||
- "CG_CLIF_COMPILE_FLAGS='--features backend_object'"
|
||||
|
53
Cargo.lock
generated
53
Cargo.lock
generated
@ -5,11 +5,6 @@ name = "adler32"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ar"
|
||||
version = "0.8.0"
|
||||
@ -91,19 +86,6 @@ name = "cranelift-entity"
|
||||
version = "0.52.0"
|
||||
source = "git+https://github.com/bytecodealliance/cranelift/#f4684ccdefd5841dc02a8d3db377de60231a0126"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-faerie"
|
||||
version = "0.52.0"
|
||||
source = "git+https://github.com/bytecodealliance/cranelift/#f4684ccdefd5841dc02a8d3db377de60231a0126"
|
||||
dependencies = [
|
||||
"anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cranelift-codegen 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-module 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"faerie 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"goblin 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"target-lexicon 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-frontend"
|
||||
version = "0.52.0"
|
||||
@ -189,21 +171,6 @@ dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "faerie"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"goblin 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scroll 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"string-interner 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"target-lexicon 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thiserror 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fallible-iterator"
|
||||
version = "0.2.0"
|
||||
@ -361,12 +328,10 @@ dependencies = [
|
||||
"ar 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cranelift-codegen 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-faerie 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-frontend 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-module 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-object 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"cranelift-simplejit 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)",
|
||||
"faerie 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gimli 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -414,11 +379,6 @@ name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.1.0"
|
||||
@ -429,14 +389,6 @@ name = "stable_deref_trait"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "string-interner"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.13"
|
||||
@ -501,7 +453,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
|
||||
"checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c"
|
||||
"checksum ar 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "450575f58f7bee32816abbff470cbc47797397c2a81e0eaced4b98436daf52e1"
|
||||
"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
|
||||
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||
@ -514,7 +465,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum cranelift-codegen-meta 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-codegen-shared 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-entity 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-faerie 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-frontend 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-module 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
"checksum cranelift-native 0.52.0 (git+https://github.com/bytecodealliance/cranelift/)" = "<none>"
|
||||
@ -523,7 +473,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
||||
"checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e"
|
||||
"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
|
||||
"checksum faerie 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74b9ed6159e4a6212c61d9c6a86bee01876b192a64accecf58d5b5ae3b667b52"
|
||||
"checksum fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
|
||||
"checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f"
|
||||
"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
|
||||
@ -547,10 +496,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum scroll_derive 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8584eea9b9ff42825b46faf46a8c24d2cff13ec152fa2a50df788b87c07ee28"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
|
||||
"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4"
|
||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||
"checksum string-interner 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd710eadff449a1531351b0e43eb81ea404336fa2f56c777427ab0e32a4cf183"
|
||||
"checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8"
|
||||
"checksum target-lexicon 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d"
|
||||
"checksum thiserror 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6f357d1814b33bc2dc221243f8424104bfe72dbe911d5b71b3816a2dff1c977e"
|
||||
|
11
Cargo.toml
11
Cargo.toml
@ -7,19 +7,13 @@ edition = "2018"
|
||||
[lib]
|
||||
crate-type = ["dylib"]
|
||||
|
||||
[features]
|
||||
default = ["backend_object"]
|
||||
backend_object = ["object/write", "cranelift-object"]
|
||||
|
||||
[dependencies]
|
||||
# These have to be in sync with each other
|
||||
cranelift-codegen = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
|
||||
cranelift-frontend = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
|
||||
cranelift-module = { git = "https://github.com/bytecodealliance/cranelift/" }
|
||||
cranelift-faerie = { git = "https://github.com/bytecodealliance/cranelift/" }
|
||||
cranelift-object = { git = "https://github.com/bytecodealliance/cranelift/", optional = true }
|
||||
cranelift-object = { git = "https://github.com/bytecodealliance/cranelift/" }
|
||||
target-lexicon = "0.10.0"
|
||||
faerie = "0.14.0"
|
||||
|
||||
#goblin = "0.0.17"
|
||||
ar = "0.8.0"
|
||||
@ -30,7 +24,7 @@ indexmap = "1.0.2"
|
||||
[dependencies.object]
|
||||
version = "0.17.0"
|
||||
default-features = false
|
||||
features = ["compression", "read", "std"] # We don't need WASM support
|
||||
features = ["compression", "read", "std", "write"] # We don't need WASM support
|
||||
|
||||
[dependencies.gimli]
|
||||
version = "0.19.0"
|
||||
@ -43,7 +37,6 @@ features = ["write"] # We don't need read support
|
||||
#cranelift-frontend = { path = "../cranelift/cranelift-frontend", default-features = false, features = ["std"] }
|
||||
#cranelift-module = { path = "../cranelift/cranelift-module" }
|
||||
#cranelift-simplejit = { path = "../cranelift/cranelift-simplejit" }
|
||||
#cranelift-faerie = { path = "../cranelift/cranelift-faerie" }
|
||||
#cranelift-object = { path = "../cranelift/cranelift-object" }
|
||||
|
||||
#[patch.crates-io]
|
||||
|
@ -5,14 +5,9 @@ use rustc::session::Session;
|
||||
|
||||
use cranelift_module::{FuncId, Module};
|
||||
|
||||
use faerie::*;
|
||||
#[cfg(feature = "backend_object")]
|
||||
use object::{SectionKind, SymbolFlags, 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;
|
||||
@ -23,30 +18,6 @@ pub trait WriteMetadata {
|
||||
fn add_rustc_section(&mut self, symbol_name: String, data: Vec<u8>, is_like_osx: bool);
|
||||
}
|
||||
|
||||
impl WriteMetadata for faerie::Artifact {
|
||||
fn add_rustc_section(&mut self, symbol_name: String, data: Vec<u8>, is_like_osx: bool) {
|
||||
self
|
||||
.declare(".rustc", faerie::Decl::section(faerie::SectionKind::Data))
|
||||
.unwrap();
|
||||
self
|
||||
.define_with_symbols(".rustc", data, {
|
||||
let mut map = std::collections::BTreeMap::new();
|
||||
// FIXME implement faerie elf backend section custom symbols
|
||||
// For MachO this is necessary to prevent the linker from throwing away the .rustc section,
|
||||
// but for ELF it isn't.
|
||||
if is_like_osx {
|
||||
map.insert(
|
||||
symbol_name,
|
||||
0,
|
||||
);
|
||||
}
|
||||
map
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "backend_object")]
|
||||
impl WriteMetadata for object::write::Object {
|
||||
fn add_rustc_section(&mut self, symbol_name: String, data: Vec<u8>, _is_like_osx: bool) {
|
||||
let segment = self.segment_name(object::write::StandardSegment::Data).to_vec();
|
||||
@ -80,42 +51,6 @@ pub trait WriteDebugInfo {
|
||||
);
|
||||
}
|
||||
|
||||
impl WriteDebugInfo for FaerieProduct {
|
||||
type SectionId = SectionId;
|
||||
|
||||
fn add_debug_section(&mut self, id: SectionId, data: Vec<u8>) -> SectionId {
|
||||
self.artifact.declare_with(id.name(), Decl::section(faerie::SectionKind::Debug), data).unwrap();
|
||||
id
|
||||
}
|
||||
|
||||
fn add_debug_reloc(
|
||||
&mut self,
|
||||
_section_map: &HashMap<SectionId, Self::SectionId>,
|
||||
symbol_map: &indexmap::IndexMap<FuncId, String>,
|
||||
from: &Self::SectionId,
|
||||
reloc: &DebugReloc,
|
||||
) {
|
||||
self
|
||||
.artifact
|
||||
.link_with(
|
||||
faerie::Link {
|
||||
from: from.name(),
|
||||
to: match reloc.name {
|
||||
DebugRelocName::Section(id) => id.name(),
|
||||
DebugRelocName::Symbol(index) => &symbol_map.get_index(index).unwrap().1,
|
||||
},
|
||||
at: u64::from(reloc.offset),
|
||||
},
|
||||
faerie::Reloc::Debug {
|
||||
size: reloc.size,
|
||||
addend: reloc.addend as i32,
|
||||
},
|
||||
)
|
||||
.expect("faerie relocation error");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "backend_object")]
|
||||
impl WriteDebugInfo for ObjectProduct {
|
||||
type SectionId = (object::write::SectionId, object::write::SymbolId);
|
||||
|
||||
@ -168,30 +103,12 @@ pub trait Emit {
|
||||
fn emit(self) -> Vec<u8>;
|
||||
}
|
||||
|
||||
impl Emit for FaerieProduct {
|
||||
fn emit(self) -> Vec<u8> {
|
||||
self.artifact.emit().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "backend_object")]
|
||||
impl Emit for ObjectProduct {
|
||||
fn emit(self) -> Vec<u8> {
|
||||
self.object.write().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "backend_object"))]
|
||||
pub fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Artifact)) -> Vec<u8> {
|
||||
let mut metadata_artifact = faerie::Artifact::new(
|
||||
crate::build_isa(sess, true).triple().clone(),
|
||||
name.to_string(),
|
||||
);
|
||||
f(&mut metadata_artifact);
|
||||
metadata_artifact.emit().unwrap()
|
||||
}
|
||||
|
||||
#[cfg(feature = "backend_object")]
|
||||
pub fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Object)) -> Vec<u8> {
|
||||
let triple = crate::build_isa(sess, true).triple().clone();
|
||||
let mut metadata_object =
|
||||
@ -203,21 +120,6 @@ pub fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Object)) -> V
|
||||
|
||||
pub type Backend = impl cranelift_module::Backend<Product: Emit + WriteDebugInfo>;
|
||||
|
||||
#[cfg(not(feature = "backend_object"))]
|
||||
pub fn make_module(sess: &Session, name: String) -> Module<Backend> {
|
||||
let module: Module<FaerieBackend> = Module::new(
|
||||
FaerieBuilder::new(
|
||||
crate::build_isa(sess, true),
|
||||
name + ".o",
|
||||
FaerieTrapCollection::Disabled,
|
||||
cranelift_module::default_libcall_names(),
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
module
|
||||
}
|
||||
|
||||
#[cfg(feature = "backend_object")]
|
||||
pub fn make_module(sess: &Session, name: String) -> Module<Backend> {
|
||||
let module: Module<ObjectBackend> = Module::new(
|
||||
ObjectBuilder::new(
|
||||
|
4
test.sh
4
test.sh
@ -4,10 +4,10 @@ set -e
|
||||
|
||||
if [[ "$1" == "--release" ]]; then
|
||||
export CHANNEL='release'
|
||||
CARGO_INCREMENTAL=1 cargo build --release $CG_CLIF_COMPILE_FLAGS
|
||||
CARGO_INCREMENTAL=1 cargo build --release
|
||||
else
|
||||
export CHANNEL='debug'
|
||||
cargo build $CG_CLIF_COMPILE_FLAGS
|
||||
cargo build
|
||||
fi
|
||||
|
||||
source config.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user