@@ -158,12 +158,12 @@ pub(super) fn get_metadata_xcoff<'a>(path: &Path, data: &'a [u8]) -> Result<&'a
158
158
file. symbols ( ) . find ( |sym| sym. name ( ) == Ok ( AIX_METADATA_SYMBOL_NAME ) )
159
159
{
160
160
let offset = metadata_symbol. address ( ) as usize ;
161
- if offset < 4 {
161
+ if offset < 8 {
162
162
return Err ( format ! ( "Invalid metadata symbol offset: {offset}" ) ) ;
163
163
}
164
164
// The offset specifies the location of rustc metadata in the comment section.
165
165
// The metadata is preceded by a 4-byte length field.
166
- let len = u32 :: from_be_bytes ( info_data[ ( offset - 4 ) ..offset] . try_into ( ) . unwrap ( ) ) as usize ;
166
+ let len = u64 :: from_le_bytes ( info_data[ ( offset - 8 ) ..offset] . try_into ( ) . unwrap ( ) ) as usize ;
167
167
if offset + len > ( info_data. len ( ) as usize ) {
168
168
return Err ( format ! (
169
169
"Metadata at offset {offset} with size {len} is beyond .info section"
@@ -479,8 +479,8 @@ pub fn create_wrapper_file(
479
479
file. section_mut ( section) . flags =
480
480
SectionFlags :: Xcoff { s_flags : xcoff:: STYP_INFO as u32 } ;
481
481
482
- let len = data. len ( ) as u32 ;
483
- let offset = file. append_section_data ( section, & len. to_be_bytes ( ) , 1 ) ;
482
+ let len = data. len ( ) as u64 ;
483
+ let offset = file. append_section_data ( section, & len. to_le_bytes ( ) , 1 ) ;
484
484
// Add a symbol referring to the data in .info section.
485
485
file. add_symbol ( Symbol {
486
486
name : AIX_METADATA_SYMBOL_NAME . into ( ) ,
@@ -524,7 +524,7 @@ pub fn create_compressed_metadata_file(
524
524
symbol_name : & str ,
525
525
) -> Vec < u8 > {
526
526
let mut packed_metadata = rustc_metadata:: METADATA_HEADER . to_vec ( ) ;
527
- packed_metadata. write_all ( & ( metadata. raw_data ( ) . len ( ) as u32 ) . to_be_bytes ( ) ) . unwrap ( ) ;
527
+ packed_metadata. write_all ( & ( metadata. raw_data ( ) . len ( ) as u64 ) . to_le_bytes ( ) ) . unwrap ( ) ;
528
528
packed_metadata. extend ( metadata. raw_data ( ) ) ;
529
529
530
530
let Some ( mut file) = create_object_file ( sess) else {
@@ -599,12 +599,12 @@ pub fn create_compressed_metadata_file_for_xcoff(
599
599
section : SymbolSection :: Section ( data_section) ,
600
600
flags : SymbolFlags :: None ,
601
601
} ) ;
602
- let len = data. len ( ) as u32 ;
603
- let offset = file. append_section_data ( section, & len. to_be_bytes ( ) , 1 ) ;
602
+ let len = data. len ( ) as u64 ;
603
+ let offset = file. append_section_data ( section, & len. to_le_bytes ( ) , 1 ) ;
604
604
// Add a symbol referring to the rustc metadata.
605
605
file. add_symbol ( Symbol {
606
606
name : AIX_METADATA_SYMBOL_NAME . into ( ) ,
607
- value : offset + 4 , // The metadata is preceded by a 4 -byte length field.
607
+ value : offset + 8 , // The metadata is preceded by a 8 -byte length field.
608
608
size : 0 ,
609
609
kind : SymbolKind :: Unknown ,
610
610
scope : SymbolScope :: Dynamic ,
0 commit comments