Skip to content

Commit d65ba25

Browse files
committed
Remove faerie support
1 parent 2bd7dcd commit d65ba25

File tree

5 files changed

+4
-165
lines changed

5 files changed

+4
-165
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,3 @@ env:
2121
- RUST_BACKTRACE=1
2222
# Reduce amount of benchmark runs as they are slow.
2323
- COMPILE_RUNS=2 RUN_RUNS=2
24-
jobs:
25-
- "CG_CLIF_COMPILE_FLAGS="
26-
- "CG_CLIF_COMPILE_FLAGS='--features backend_object'"

Cargo.lock

Lines changed: 0 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@ edition = "2018"
77
[lib]
88
crate-type = ["dylib"]
99

10-
[features]
11-
default = ["backend_object"]
12-
backend_object = ["object/write", "cranelift-object"]
13-
1410
[dependencies]
1511
# These have to be in sync with each other
1612
cranelift-codegen = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
1713
cranelift-frontend = { git = "https://github.com/bytecodealliance/cranelift/", default-features = false, features = ["std"] }
1814
cranelift-module = { git = "https://github.com/bytecodealliance/cranelift/" }
19-
cranelift-faerie = { git = "https://github.com/bytecodealliance/cranelift/" }
20-
cranelift-object = { git = "https://github.com/bytecodealliance/cranelift/", optional = true }
15+
cranelift-object = { git = "https://github.com/bytecodealliance/cranelift/" }
2116
target-lexicon = "0.10.0"
22-
faerie = "0.14.0"
2317

2418
#goblin = "0.0.17"
2519
ar = "0.8.0"
@@ -30,7 +24,7 @@ indexmap = "1.0.2"
3024
[dependencies.object]
3125
version = "0.17.0"
3226
default-features = false
33-
features = ["compression", "read", "std"] # We don't need WASM support
27+
features = ["compression", "read", "std", "write"] # We don't need WASM support
3428

3529
[dependencies.gimli]
3630
version = "0.19.0"
@@ -43,7 +37,6 @@ features = ["write"] # We don't need read support
4337
#cranelift-frontend = { path = "../cranelift/cranelift-frontend", default-features = false, features = ["std"] }
4438
#cranelift-module = { path = "../cranelift/cranelift-module" }
4539
#cranelift-simplejit = { path = "../cranelift/cranelift-simplejit" }
46-
#cranelift-faerie = { path = "../cranelift/cranelift-faerie" }
4740
#cranelift-object = { path = "../cranelift/cranelift-object" }
4841

4942
#[patch.crates-io]

src/backend.rs

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@ use rustc::session::Session;
55

66
use cranelift_module::{FuncId, Module};
77

8-
use faerie::*;
9-
#[cfg(feature = "backend_object")]
108
use object::{SectionKind, SymbolFlags, RelocationKind, RelocationEncoding};
11-
#[cfg(feature = "backend_object")]
129
use object::write::*;
13-
use cranelift_faerie::{FaerieBackend, FaerieBuilder, FaerieProduct, FaerieTrapCollection};
1410

15-
#[cfg(feature = "backend_object")]
1611
use cranelift_object::*;
1712

1813
use gimli::SectionId;
@@ -23,30 +18,6 @@ pub trait WriteMetadata {
2318
fn add_rustc_section(&mut self, symbol_name: String, data: Vec<u8>, is_like_osx: bool);
2419
}
2520

26-
impl WriteMetadata for faerie::Artifact {
27-
fn add_rustc_section(&mut self, symbol_name: String, data: Vec<u8>, is_like_osx: bool) {
28-
self
29-
.declare(".rustc", faerie::Decl::section(faerie::SectionKind::Data))
30-
.unwrap();
31-
self
32-
.define_with_symbols(".rustc", data, {
33-
let mut map = std::collections::BTreeMap::new();
34-
// FIXME implement faerie elf backend section custom symbols
35-
// For MachO this is necessary to prevent the linker from throwing away the .rustc section,
36-
// but for ELF it isn't.
37-
if is_like_osx {
38-
map.insert(
39-
symbol_name,
40-
0,
41-
);
42-
}
43-
map
44-
})
45-
.unwrap();
46-
}
47-
}
48-
49-
#[cfg(feature = "backend_object")]
5021
impl WriteMetadata for object::write::Object {
5122
fn add_rustc_section(&mut self, symbol_name: String, data: Vec<u8>, _is_like_osx: bool) {
5223
let segment = self.segment_name(object::write::StandardSegment::Data).to_vec();
@@ -80,42 +51,6 @@ pub trait WriteDebugInfo {
8051
);
8152
}
8253

83-
impl WriteDebugInfo for FaerieProduct {
84-
type SectionId = SectionId;
85-
86-
fn add_debug_section(&mut self, id: SectionId, data: Vec<u8>) -> SectionId {
87-
self.artifact.declare_with(id.name(), Decl::section(faerie::SectionKind::Debug), data).unwrap();
88-
id
89-
}
90-
91-
fn add_debug_reloc(
92-
&mut self,
93-
_section_map: &HashMap<SectionId, Self::SectionId>,
94-
symbol_map: &indexmap::IndexMap<FuncId, String>,
95-
from: &Self::SectionId,
96-
reloc: &DebugReloc,
97-
) {
98-
self
99-
.artifact
100-
.link_with(
101-
faerie::Link {
102-
from: from.name(),
103-
to: match reloc.name {
104-
DebugRelocName::Section(id) => id.name(),
105-
DebugRelocName::Symbol(index) => &symbol_map.get_index(index).unwrap().1,
106-
},
107-
at: u64::from(reloc.offset),
108-
},
109-
faerie::Reloc::Debug {
110-
size: reloc.size,
111-
addend: reloc.addend as i32,
112-
},
113-
)
114-
.expect("faerie relocation error");
115-
}
116-
}
117-
118-
#[cfg(feature = "backend_object")]
11954
impl WriteDebugInfo for ObjectProduct {
12055
type SectionId = (object::write::SectionId, object::write::SymbolId);
12156

@@ -168,30 +103,12 @@ pub trait Emit {
168103
fn emit(self) -> Vec<u8>;
169104
}
170105

171-
impl Emit for FaerieProduct {
172-
fn emit(self) -> Vec<u8> {
173-
self.artifact.emit().unwrap()
174-
}
175-
}
176-
177-
#[cfg(feature = "backend_object")]
178106
impl Emit for ObjectProduct {
179107
fn emit(self) -> Vec<u8> {
180108
self.object.write().unwrap()
181109
}
182110
}
183111

184-
#[cfg(not(feature = "backend_object"))]
185-
pub fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Artifact)) -> Vec<u8> {
186-
let mut metadata_artifact = faerie::Artifact::new(
187-
crate::build_isa(sess, true).triple().clone(),
188-
name.to_string(),
189-
);
190-
f(&mut metadata_artifact);
191-
metadata_artifact.emit().unwrap()
192-
}
193-
194-
#[cfg(feature = "backend_object")]
195112
pub fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Object)) -> Vec<u8> {
196113
let triple = crate::build_isa(sess, true).triple().clone();
197114
let mut metadata_object =
@@ -203,21 +120,6 @@ pub fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Object)) -> V
203120

204121
pub type Backend = impl cranelift_module::Backend<Product: Emit + WriteDebugInfo>;
205122

206-
#[cfg(not(feature = "backend_object"))]
207-
pub fn make_module(sess: &Session, name: String) -> Module<Backend> {
208-
let module: Module<FaerieBackend> = Module::new(
209-
FaerieBuilder::new(
210-
crate::build_isa(sess, true),
211-
name + ".o",
212-
FaerieTrapCollection::Disabled,
213-
cranelift_module::default_libcall_names(),
214-
)
215-
.unwrap(),
216-
);
217-
module
218-
}
219-
220-
#[cfg(feature = "backend_object")]
221123
pub fn make_module(sess: &Session, name: String) -> Module<Backend> {
222124
let module: Module<ObjectBackend> = Module::new(
223125
ObjectBuilder::new(

test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ set -e
44

55
if [[ "$1" == "--release" ]]; then
66
export CHANNEL='release'
7-
CARGO_INCREMENTAL=1 cargo build --release $CG_CLIF_COMPILE_FLAGS
7+
CARGO_INCREMENTAL=1 cargo build --release
88
else
99
export CHANNEL='debug'
10-
cargo build $CG_CLIF_COMPILE_FLAGS
10+
cargo build
1111
fi
1212

1313
source config.sh

0 commit comments

Comments
 (0)