@@ -17,7 +17,7 @@ use crate::{
17
17
Symbol , SymbolFlag , SymbolKind ,
18
18
split_meta:: { SPLITMETA_SECTION , SplitMeta } ,
19
19
} ,
20
- util:: { read_u16, read_u32} ,
20
+ util:: { align_data_slice_to_4 , align_size_to_4 , align_u64_to_4 , read_u16, read_u32} ,
21
21
} ;
22
22
23
23
fn map_section_kind ( section : & object:: Section ) -> SectionKind {
@@ -739,7 +739,9 @@ fn do_combine_sections(
739
739
}
740
740
offsets. push ( current_offset) ;
741
741
current_offset += section. size ;
742
+ current_offset = align_u64_to_4 ( current_offset) ;
742
743
data_size += section. data . len ( ) ;
744
+ data_size = align_size_to_4 ( data_size) ;
743
745
num_relocations += section. relocations . len ( ) ;
744
746
}
745
747
if data_size > 0 {
@@ -754,6 +756,7 @@ fn do_combine_sections(
754
756
let section = & mut sections[ i] ;
755
757
section. size = 0 ;
756
758
data. append ( & mut section. data . 0 ) ;
759
+ align_data_slice_to_4 ( & mut data) ;
757
760
section. relocations . iter_mut ( ) . for_each ( |r| r. address += offset) ;
758
761
relocations. append ( & mut section. relocations ) ;
759
762
line_info. append ( & mut section. line_info . iter ( ) . map ( |( & a, & l) | ( a + offset, l) ) . collect ( ) ) ;
0 commit comments