Skip to content

Commit 6eaa502

Browse files
committed
Update Cranelift for SimpleJIT changes
1 parent 96c4542 commit 6eaa502

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/debuginfo/emit.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,17 @@ impl WriterRelocate {
7676
#[cfg(feature = "jit")]
7777
pub(super) fn relocate_for_jit(
7878
mut self,
79-
jit_product: &cranelift_simplejit::SimpleJITProduct,
79+
jit_module: &cranelift_simplejit::SimpleJITModule,
8080
) -> Vec<u8> {
8181
use std::convert::TryInto;
8282

8383
for reloc in self.relocs.drain(..) {
8484
match reloc.name {
8585
super::DebugRelocName::Section(_) => unreachable!(),
8686
super::DebugRelocName::Symbol(sym) => {
87-
let addr = jit_product
88-
.lookup_func(cranelift_module::FuncId::from_u32(sym.try_into().unwrap()));
87+
let addr = jit_module.get_finalized_function(
88+
cranelift_module::FuncId::from_u32(sym.try_into().unwrap()),
89+
);
8990
let val = (addr as u64 as i64 + reloc.addend) as u64;
9091
self.writer
9192
.write_udata_at(reloc.offset as usize, val, reloc.size)

src/debuginfo/unwind.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<'tcx> UnwindContext<'tcx> {
8080
#[cfg(feature = "jit")]
8181
pub(crate) unsafe fn register_jit(
8282
self,
83-
jit_product: &cranelift_simplejit::SimpleJITProduct,
83+
jit_module: &cranelift_simplejit::SimpleJITModule,
8484
) -> Option<UnwindRegistry> {
8585
let mut eh_frame = EhFrame::from(super::emit::WriterRelocate::new(super::target_endian(
8686
self.tcx,
@@ -91,7 +91,7 @@ impl<'tcx> UnwindContext<'tcx> {
9191
return None;
9292
}
9393

94-
let mut eh_frame = eh_frame.0.relocate_for_jit(jit_product);
94+
let mut eh_frame = eh_frame.0.relocate_for_jit(jit_module);
9595

9696
// GCC expects a terminating "empty" length, so write a 0 length at the end of the table.
9797
eh_frame.extend(&[0, 0, 0, 0]);

src/driver/jit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
8181

8282
tcx.sess.abort_if_errors();
8383

84-
let jit_product = jit_module.finish();
84+
jit_module.finalize_definitions();
8585

86-
let _unwind_register_guard = unsafe { unwind_context.register_jit(&jit_product) };
86+
let _unwind_register_guard = unsafe { unwind_context.register_jit(&jit_module) };
8787

88-
let finalized_main: *const u8 = jit_product.lookup_func(main_func_id);
88+
let finalized_main: *const u8 = jit_module.get_finalized_function(main_func_id);
8989

9090
println!("Rustc codegen cranelift will JIT run the executable, because --jit was passed");
9191

0 commit comments

Comments
 (0)