mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
fix cranelift and gcc
This commit is contained in:
parent
3db45f00ff
commit
eb4bdb00a4
@ -398,7 +398,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
|
|||||||
let bytes = alloc.inspect_with_uninit_and_ptr_outside_interpreter(0..alloc.len()).to_vec();
|
let bytes = alloc.inspect_with_uninit_and_ptr_outside_interpreter(0..alloc.len()).to_vec();
|
||||||
data_ctx.define(bytes.into_boxed_slice());
|
data_ctx.define(bytes.into_boxed_slice());
|
||||||
|
|
||||||
for &(offset, alloc_id) in alloc.provenance().iter() {
|
for &(offset, alloc_id) in alloc.provenance().ptrs().iter() {
|
||||||
let addend = {
|
let addend = {
|
||||||
let endianness = tcx.data_layout.endian;
|
let endianness = tcx.data_layout.endian;
|
||||||
let offset = offset.bytes() as usize;
|
let offset = offset.bytes() as usize;
|
||||||
@ -431,7 +431,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
|
|||||||
{
|
{
|
||||||
tcx.sess.fatal(&format!(
|
tcx.sess.fatal(&format!(
|
||||||
"Allocation {:?} contains reference to TLS value {:?}",
|
"Allocation {:?} contains reference to TLS value {:?}",
|
||||||
alloc, def_id
|
alloc_id, def_id
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,12 +297,12 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
|||||||
|
|
||||||
pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: ConstAllocation<'tcx>) -> RValue<'gcc> {
|
pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: ConstAllocation<'tcx>) -> RValue<'gcc> {
|
||||||
let alloc = alloc.inner();
|
let alloc = alloc.inner();
|
||||||
let mut llvals = Vec::with_capacity(alloc.provenance().len() + 1);
|
let mut llvals = Vec::with_capacity(alloc.provenance().ptrs().len() + 1);
|
||||||
let dl = cx.data_layout();
|
let dl = cx.data_layout();
|
||||||
let pointer_size = dl.pointer_size.bytes() as usize;
|
let pointer_size = dl.pointer_size.bytes() as usize;
|
||||||
|
|
||||||
let mut next_offset = 0;
|
let mut next_offset = 0;
|
||||||
for &(offset, alloc_id) in alloc.provenance().iter() {
|
for &(offset, alloc_id) in alloc.provenance().ptrs().iter() {
|
||||||
let offset = offset.bytes();
|
let offset = offset.bytes();
|
||||||
assert_eq!(offset as usize as u64, offset);
|
assert_eq!(offset as usize as u64, offset);
|
||||||
let offset = offset as usize;
|
let offset = offset as usize;
|
||||||
|
Loading…
Reference in New Issue
Block a user