diff options
| author | bors <bors@rust-lang.org> | 2023-12-12 07:09:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-12 07:09:19 +0000 |
| commit | fda521a988749458326ecef2e92e979077727a4e (patch) | |
| tree | 73ec9f26b38eb86b5676735f79e577c12fe0024a /compiler/rustc_codegen_ssa/src | |
| parent | aaeb4dd3a93a6be4cba5eb173f35453803994773 (diff) | |
| parent | 03b7ed06c88ae869daa4f2a30ef341918cc76ac7 (diff) | |
| download | rust-fda521a988749458326ecef2e92e979077727a4e.tar.gz rust-fda521a988749458326ecef2e92e979077727a4e.zip | |
Auto merge of #3223 - rust-lang:rustup-2023-12-12, r=RalfJung
Automatic Rustup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/metadata.rs | 18 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/operand.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/statement.rs | 1 |
3 files changed, 10 insertions, 11 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index 3e26e3653ea..bc0e3a82806 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -158,12 +158,12 @@ pub(super) fn get_metadata_xcoff<'a>(path: &Path, data: &'a [u8]) -> Result<&'a file.symbols().find(|sym| sym.name() == Ok(AIX_METADATA_SYMBOL_NAME)) { let offset = metadata_symbol.address() as usize; - if offset < 4 { + if offset < 8 { return Err(format!("Invalid metadata symbol offset: {offset}")); } // The offset specifies the location of rustc metadata in the comment section. - // The metadata is preceded by a 4-byte length field. - let len = u32::from_be_bytes(info_data[(offset - 4)..offset].try_into().unwrap()) as usize; + // The metadata is preceded by a 8-byte length field. + let len = u64::from_le_bytes(info_data[(offset - 8)..offset].try_into().unwrap()) as usize; if offset + len > (info_data.len() as usize) { return Err(format!( "Metadata at offset {offset} with size {len} is beyond .info section" @@ -479,8 +479,8 @@ pub fn create_wrapper_file( file.section_mut(section).flags = SectionFlags::Xcoff { s_flags: xcoff::STYP_INFO as u32 }; - let len = data.len() as u32; - let offset = file.append_section_data(section, &len.to_be_bytes(), 1); + let len = data.len() as u64; + let offset = file.append_section_data(section, &len.to_le_bytes(), 1); // Add a symbol referring to the data in .info section. file.add_symbol(Symbol { name: AIX_METADATA_SYMBOL_NAME.into(), @@ -524,7 +524,7 @@ pub fn create_compressed_metadata_file( symbol_name: &str, ) -> Vec<u8> { let mut packed_metadata = rustc_metadata::METADATA_HEADER.to_vec(); - packed_metadata.write_all(&(metadata.raw_data().len() as u32).to_be_bytes()).unwrap(); + packed_metadata.write_all(&(metadata.raw_data().len() as u64).to_le_bytes()).unwrap(); packed_metadata.extend(metadata.raw_data()); let Some(mut file) = create_object_file(sess) else { @@ -599,12 +599,12 @@ pub fn create_compressed_metadata_file_for_xcoff( section: SymbolSection::Section(data_section), flags: SymbolFlags::None, }); - let len = data.len() as u32; - let offset = file.append_section_data(section, &len.to_be_bytes(), 1); + let len = data.len() as u64; + let offset = file.append_section_data(section, &len.to_le_bytes(), 1); // Add a symbol referring to the rustc metadata. file.add_symbol(Symbol { name: AIX_METADATA_SYMBOL_NAME.into(), - value: offset + 4, // The metadata is preceded by a 4-byte length field. + value: offset + 8, // The metadata is preceded by a 8-byte length field. size: 0, kind: SymbolKind::Unknown, scope: SymbolScope::Dynamic, diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index d724f9503bb..feee3ac03d0 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -155,7 +155,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { Abi::Scalar(s @ abi::Scalar::Initialized { .. }) => { let size = s.size(bx); assert_eq!(size, layout.size, "abi::Scalar size does not match layout size"); - let val = read_scalar(offset, size, s, bx.backend_type(layout)); + let val = read_scalar(offset, size, s, bx.immediate_backend_type(layout)); OperandRef { val: OperandValue::Immediate(val), layout } } Abi::ScalarPair( diff --git a/compiler/rustc_codegen_ssa/src/mir/statement.rs b/compiler/rustc_codegen_ssa/src/mir/statement.rs index 899e41265bb..a158fc6e260 100644 --- a/compiler/rustc_codegen_ssa/src/mir/statement.rs +++ b/compiler/rustc_codegen_ssa/src/mir/statement.rs @@ -3,7 +3,6 @@ use rustc_middle::mir::NonDivergingIntrinsic; use super::FunctionCx; use super::LocalRef; -use crate::traits::BuilderMethods; use crate::traits::*; impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
