@@ -5,14 +5,9 @@ use rustc::session::Session;
5
5
6
6
use cranelift_module:: { FuncId , Module } ;
7
7
8
- use faerie:: * ;
9
- #[ cfg( feature = "backend_object" ) ]
10
8
use object:: { SectionKind , SymbolFlags , RelocationKind , RelocationEncoding } ;
11
- #[ cfg( feature = "backend_object" ) ]
12
9
use object:: write:: * ;
13
- use cranelift_faerie:: { FaerieBackend , FaerieBuilder , FaerieProduct , FaerieTrapCollection } ;
14
10
15
- #[ cfg( feature = "backend_object" ) ]
16
11
use cranelift_object:: * ;
17
12
18
13
use gimli:: SectionId ;
@@ -23,30 +18,6 @@ pub trait WriteMetadata {
23
18
fn add_rustc_section ( & mut self , symbol_name : String , data : Vec < u8 > , is_like_osx : bool ) ;
24
19
}
25
20
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" ) ]
50
21
impl WriteMetadata for object:: write:: Object {
51
22
fn add_rustc_section ( & mut self , symbol_name : String , data : Vec < u8 > , _is_like_osx : bool ) {
52
23
let segment = self . segment_name ( object:: write:: StandardSegment :: Data ) . to_vec ( ) ;
@@ -80,42 +51,6 @@ pub trait WriteDebugInfo {
80
51
) ;
81
52
}
82
53
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" ) ]
119
54
impl WriteDebugInfo for ObjectProduct {
120
55
type SectionId = ( object:: write:: SectionId , object:: write:: SymbolId ) ;
121
56
@@ -168,30 +103,12 @@ pub trait Emit {
168
103
fn emit ( self ) -> Vec < u8 > ;
169
104
}
170
105
171
- impl Emit for FaerieProduct {
172
- fn emit ( self ) -> Vec < u8 > {
173
- self . artifact . emit ( ) . unwrap ( )
174
- }
175
- }
176
-
177
- #[ cfg( feature = "backend_object" ) ]
178
106
impl Emit for ObjectProduct {
179
107
fn emit ( self ) -> Vec < u8 > {
180
108
self . object . write ( ) . unwrap ( )
181
109
}
182
110
}
183
111
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" ) ]
195
112
pub fn with_object ( sess : & Session , name : & str , f : impl FnOnce ( & mut Object ) ) -> Vec < u8 > {
196
113
let triple = crate :: build_isa ( sess, true ) . triple ( ) . clone ( ) ;
197
114
let mut metadata_object =
@@ -203,21 +120,6 @@ pub fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Object)) -> V
203
120
204
121
pub type Backend = impl cranelift_module:: Backend < Product : Emit + WriteDebugInfo > ;
205
122
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" ) ]
221
123
pub fn make_module ( sess : & Session , name : String ) -> Module < Backend > {
222
124
let module: Module < ObjectBackend > = Module :: new (
223
125
ObjectBuilder :: new (
0 commit comments