1
Fork 0

Merge commit '5988bbd24a' into sync_cg_clif-2020-11-27

This commit is contained in:
bjorn3 2020-11-27 20:48:53 +01:00
commit 477aa67802
33 changed files with 400 additions and 222 deletions

View file

@ -76,7 +76,7 @@ impl WriterRelocate {
#[cfg(feature = "jit")]
pub(super) fn relocate_for_jit(
mut self,
jit_product: &cranelift_simplejit::SimpleJITProduct,
jit_module: &cranelift_simplejit::SimpleJITModule,
) -> Vec<u8> {
use std::convert::TryInto;
@ -84,8 +84,9 @@ impl WriterRelocate {
match reloc.name {
super::DebugRelocName::Section(_) => unreachable!(),
super::DebugRelocName::Symbol(sym) => {
let addr = jit_product
.lookup_func(cranelift_module::FuncId::from_u32(sym.try_into().unwrap()));
let addr = jit_module.get_finalized_function(
cranelift_module::FuncId::from_u32(sym.try_into().unwrap()),
);
let val = (addr as u64 as i64 + reloc.addend) as u64;
self.writer
.write_udata_at(reloc.offset as usize, val, reloc.size)

View file

@ -80,7 +80,7 @@ impl<'tcx> UnwindContext<'tcx> {
#[cfg(feature = "jit")]
pub(crate) unsafe fn register_jit(
self,
jit_product: &cranelift_simplejit::SimpleJITProduct,
jit_module: &cranelift_simplejit::SimpleJITModule,
) -> Option<UnwindRegistry> {
let mut eh_frame = EhFrame::from(super::emit::WriterRelocate::new(super::target_endian(
self.tcx,
@ -91,7 +91,7 @@ impl<'tcx> UnwindContext<'tcx> {
return None;
}
let mut eh_frame = eh_frame.0.relocate_for_jit(jit_product);
let mut eh_frame = eh_frame.0.relocate_for_jit(jit_module);
// GCC expects a terminating "empty" length, so write a 0 length at the end of the table.
eh_frame.extend(&[0, 0, 0, 0]);