about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/driver/jit.rs
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-05-13 13:26:33 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-05-13 13:26:33 +0000
commit75f8bdbca4965896c3d3ead656f6a13e8409a78b (patch)
treed8fba5cd3ad9aee184393d91c0c1b01fc5e76faa /compiler/rustc_codegen_cranelift/src/driver/jit.rs
parentabb95639ef2b837dbfe7b5d18f51fadda29711cb (diff)
parent3270432f4b0583104c8b9b6f695bf97d6bbf3ac2 (diff)
downloadrust-75f8bdbca4965896c3d3ead656f6a13e8409a78b.tar.gz
rust-75f8bdbca4965896c3d3ead656f6a13e8409a78b.zip
Merge commit '3270432f4b0583104c8b9b6f695bf97d6bbf3ac2' into sync_cg_clif-2024-05-13
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/driver/jit.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/driver/jit.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/driver/jit.rs b/compiler/rustc_codegen_cranelift/src/driver/jit.rs
index 929fa92596d..4b149131b61 100644
--- a/compiler/rustc_codegen_cranelift/src/driver/jit.rs
+++ b/compiler/rustc_codegen_cranelift/src/driver/jit.rs
@@ -83,13 +83,6 @@ fn create_jit_module(
     );
 
     crate::allocator::codegen(tcx, &mut jit_module, &mut cx.unwind_context);
-    crate::main_shim::maybe_create_entry_wrapper(
-        tcx,
-        &mut jit_module,
-        &mut cx.unwind_context,
-        true,
-        true,
-    );
 
     (jit_module, cx)
 }
@@ -153,6 +146,14 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
         tcx.dcx().fatal("Inline asm is not supported in JIT mode");
     }
 
+    crate::main_shim::maybe_create_entry_wrapper(
+        tcx,
+        &mut jit_module,
+        &mut cx.unwind_context,
+        true,
+        true,
+    );
+
     tcx.dcx().abort_if_errors();
 
     jit_module.finalize_definitions().unwrap();
@@ -231,16 +232,16 @@ pub(crate) fn codegen_and_compile_fn<'tcx>(
             crate::PrintOnPanic(|| format!("{:?} {}", instance, tcx.symbol_name(instance).name));
 
         let cached_func = std::mem::replace(&mut cached_context.func, Function::new());
-        let codegened_func = crate::base::codegen_fn(
+        if let Some(codegened_func) = crate::base::codegen_fn(
             tcx,
             cx,
             &mut TypeDebugContext::default(),
             cached_func,
             module,
             instance,
-        );
-
-        crate::base::compile_fn(cx, cached_context, module, codegened_func);
+        ) {
+            crate::base::compile_fn(cx, cached_context, module, codegened_func);
+        }
     });
 }