This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ pub(super) fn get_metadata_xcoff<'a>(path: &Path, data: &'a [u8]) -> Result<&'a
159
159
{
160
160
let offset = metadata_symbol. address ( ) as usize ;
161
161
// The offset specifies the location of rustc metadata in the .info section of XCOFF.
162
- // Each string stored in .info section of XCOFF is preceded by a 4-byte lenght field.
162
+ // Each string stored in .info section of XCOFF is preceded by a 4-byte length field.
163
163
if offset < 4 {
164
164
return Err ( format ! ( "Invalid metadata symbol offset: {offset}" ) ) ;
165
165
}
@@ -480,7 +480,10 @@ pub fn create_wrapper_file(
480
480
file. section_mut ( section) . flags =
481
481
SectionFlags :: Xcoff { s_flags : xcoff:: STYP_INFO as u32 } ;
482
482
// Encode string stored in .info section of XCOFF.
483
- let len = data. len ( ) as u32 ;
483
+ // FIXME: The length of data here is not guaranteed to fit in a u32.
484
+ // We may have to split the data into multiple pieces in order to
485
+ // store in .info section.
486
+ let len: u32 = data. len ( ) . try_into ( ) . unwrap ( ) ;
484
487
let offset = file. append_section_data ( section, & len. to_be_bytes ( ) , 1 ) ;
485
488
// Add a symbol referring to the data in .info section.
486
489
file. add_symbol ( Symbol {
You can’t perform that action at this time.
0 commit comments