11use crate :: error:: Error ;
22use crate :: name:: Name ;
33use crate :: stack_probe;
4- use crate :: table:: { TABLE_SYM , TABLE_REF_SIZE } ;
4+ use crate :: table:: { TABLE_REF_SIZE , TABLE_SYM } ;
55use crate :: traps:: { translate_trapcode, trap_sym_for_func} ;
66use byteorder:: { LittleEndian , WriteBytesExt } ;
7- use cranelift_codegen:: { ir , isa , binemit:: TrapSink } ;
7+ use cranelift_codegen:: { binemit:: TrapSink , ir , isa } ;
88use cranelift_faerie:: traps:: { FaerieTrapManifest , FaerieTrapSink } ;
99use cranelift_faerie:: FaerieProduct ;
1010use faerie:: { Artifact , Decl , Link } ;
@@ -108,14 +108,16 @@ impl ObjectFile {
108108 traps : & mut FaerieTrapManifest ,
109109 function_manifest : & mut Vec < ( String , FunctionSpec ) > ,
110110 ) -> Result < ( ) , Error > {
111- self . artifact . declare_with (
112- stack_probe:: STACK_PROBE_SYM ,
113- Decl :: function ( ) ,
114- stack_probe:: STACK_PROBE_BINARY . to_vec ( ) ,
115- ) . map_err ( |source| {
116- let message = format ! ( "Error declaring {}" , stack_probe:: STACK_PROBE_SYM ) ;
117- Error :: Failure ( source, message)
118- } ) ?;
111+ self . artifact
112+ . declare_with (
113+ stack_probe:: STACK_PROBE_SYM ,
114+ Decl :: function ( ) ,
115+ stack_probe:: STACK_PROBE_BINARY . to_vec ( ) ,
116+ )
117+ . map_err ( |source| {
118+ let message = format ! ( "Error declaring {}" , stack_probe:: STACK_PROBE_SYM ) ;
119+ Error :: Failure ( source, message)
120+ } ) ?;
119121
120122 {
121123 let mut stack_probe_trap_sink = FaerieTrapSink :: new (
@@ -160,7 +162,8 @@ impl ObjectFile {
160162 & mut self ,
161163 functions : & [ ( String , FunctionSpec ) ] ,
162164 ) -> Result < ( ) , Error > {
163- self . artifact . declare ( FUNCTION_MANIFEST_SYM , Decl :: data ( ) )
165+ self . artifact
166+ . declare ( FUNCTION_MANIFEST_SYM , Decl :: data ( ) )
164167 . map_err ( |source| {
165168 let message = format ! ( "Manifest error declaring {}" , FUNCTION_MANIFEST_SYM ) ;
166169 Error :: ArtifactError ( source, message)
@@ -204,7 +207,8 @@ impl ObjectFile {
204207 ) ?;
205208 }
206209
207- self . artifact . define ( FUNCTION_MANIFEST_SYM , manifest_buf. into_inner ( ) )
210+ self . artifact
211+ . define ( FUNCTION_MANIFEST_SYM , manifest_buf. into_inner ( ) )
208212 . map_err ( |source| {
209213 let message = format ! ( "Manifest error declaring {}" , FUNCTION_MANIFEST_SYM ) ;
210214 Error :: ArtifactError ( source, message)
@@ -218,10 +222,12 @@ impl ObjectFile {
218222 let func_sym = & sink. name ;
219223 let trap_sym = trap_sym_for_func ( func_sym) ;
220224
221- self . artifact . declare ( & trap_sym, Decl :: data ( ) ) . map_err ( |source| {
222- let message = format ! ( "Trap table error declaring {}" , trap_sym) ;
223- Error :: ArtifactError ( source, message)
224- } ) ?;
225+ self . artifact
226+ . declare ( & trap_sym, Decl :: data ( ) )
227+ . map_err ( |source| {
228+ let message = format ! ( "Trap table error declaring {}" , trap_sym) ;
229+ Error :: ArtifactError ( source, message)
230+ } ) ?;
225231
226232 // write the actual function-level trap table
227233 let traps: Vec < TrapSite > = sink
@@ -241,7 +247,8 @@ impl ObjectFile {
241247 } ;
242248
243249 // and write the function trap table into the object
244- self . artifact . define ( & trap_sym, trap_site_bytes. to_vec ( ) )
250+ self . artifact
251+ . define ( & trap_sym, trap_site_bytes. to_vec ( ) )
245252 . map_err ( |source| {
246253 let message = format ! ( "Trap table error defining {}" , trap_sym) ;
247254 Error :: ArtifactError ( source, message)
@@ -253,11 +260,12 @@ impl ObjectFile {
253260
254261 fn link_tables ( & mut self , tables : & [ Name ] ) -> Result < ( ) , Error > {
255262 for ( idx, table) in tables. iter ( ) . enumerate ( ) {
256- self . artifact . link ( Link {
257- from : TABLE_SYM ,
258- to : table. symbol ( ) ,
259- at : ( TABLE_REF_SIZE * idx) as u64 ,
260- } )
263+ self . artifact
264+ . link ( Link {
265+ from : TABLE_SYM ,
266+ to : table. symbol ( ) ,
267+ at : ( TABLE_REF_SIZE * idx) as u64 ,
268+ } )
261269 . map_err ( |source| Error :: Failure ( source, "Table error" . to_owned ( ) ) ) ?;
262270 }
263271 Ok ( ( ) )
0 commit comments