@@ -5,8 +5,11 @@ use cranelift_codegen::isa::{
55 TargetIsa ,
66 unwind:: { CfaUnwindInfo , UnwindInfo } ,
77} ;
8- use gimli:: write:: { Address , Dwarf , EndianVec , FrameTable , Result , Sections , Writer } ;
8+ use gimli:: write:: {
9+ Address , Dwarf , EndianVec , FrameTable , Result as WriteResult , Sections , Writer ,
10+ } ;
911use gimli:: { RunTimeEndian , SectionId } ;
12+ use wasmtime_environ:: error:: Result as EnvResult ;
1013
1114pub struct DwarfSection {
1215 pub name : & ' static str ,
@@ -32,7 +35,7 @@ fn emit_dwarf_sections(
3235 isa : & dyn TargetIsa ,
3336 mut dwarf : Dwarf ,
3437 frames : Option < FrameTable > ,
35- ) -> wasmtime_environ :: error :: Result < Vec < DwarfSection > > {
38+ ) -> EnvResult < Vec < DwarfSection > > {
3639 let endian = match isa. endianness ( ) {
3740 Endianness :: Little => RunTimeEndian :: Little ,
3841 Endianness :: Big => RunTimeEndian :: Big ,
@@ -48,7 +51,7 @@ fn emit_dwarf_sections(
4851 }
4952
5053 let mut result = Vec :: new ( ) ;
51- sections. for_each_mut ( |id, s| -> wasmtime_environ :: error :: Result < ( ) > {
54+ sections. for_each_mut ( |id, s| -> EnvResult < ( ) > {
5255 let name = id. name ( ) ;
5356 let body = s. writer . take ( ) ;
5457 if body. is_empty ( ) {
@@ -80,15 +83,15 @@ impl Writer for WriterRelocate {
8083 self . writer . len ( )
8184 }
8285
83- fn write ( & mut self , bytes : & [ u8 ] ) -> Result < ( ) > {
86+ fn write ( & mut self , bytes : & [ u8 ] ) -> WriteResult < ( ) > {
8487 self . writer . write ( bytes)
8588 }
8689
87- fn write_at ( & mut self , offset : usize , bytes : & [ u8 ] ) -> Result < ( ) > {
90+ fn write_at ( & mut self , offset : usize , bytes : & [ u8 ] ) -> WriteResult < ( ) > {
8891 self . writer . write_at ( offset, bytes)
8992 }
9093
91- fn write_address ( & mut self , address : Address , size : u8 ) -> Result < ( ) > {
94+ fn write_address ( & mut self , address : Address , size : u8 ) -> WriteResult < ( ) > {
9295 match address {
9396 Address :: Constant ( val) => self . write_udata ( val, size) ,
9497 Address :: Symbol { symbol, addend } => {
@@ -104,7 +107,7 @@ impl Writer for WriterRelocate {
104107 }
105108 }
106109
107- fn write_offset ( & mut self , val : usize , section : SectionId , size : u8 ) -> Result < ( ) > {
110+ fn write_offset ( & mut self , val : usize , section : SectionId , size : u8 ) -> WriteResult < ( ) > {
108111 let offset = self . len ( ) as u32 ;
109112 let target = DwarfSectionRelocTarget :: Section ( section. name ( ) ) ;
110113 self . relocs . push ( DwarfSectionReloc {
@@ -122,7 +125,7 @@ impl Writer for WriterRelocate {
122125 val : usize ,
123126 section : SectionId ,
124127 size : u8 ,
125- ) -> Result < ( ) > {
128+ ) -> WriteResult < ( ) > {
126129 let target = DwarfSectionRelocTarget :: Section ( section. name ( ) ) ;
127130 self . relocs . push ( DwarfSectionReloc {
128131 target,
@@ -165,7 +168,7 @@ fn create_frame_table(
165168pub fn emit_dwarf (
166169 isa : & dyn TargetIsa ,
167170 compilation : & mut Compilation < ' _ > ,
168- ) -> wasmtime_environ :: error :: Result < Vec < DwarfSection > > {
171+ ) -> EnvResult < Vec < DwarfSection > > {
169172 let dwarf = transform_dwarf ( isa, compilation) ?;
170173 let frame_table = create_frame_table ( isa, compilation) ;
171174 let sections = emit_dwarf_sections ( isa, dwarf, frame_table) ?;
0 commit comments