diff --git a/Cargo.lock b/Cargo.lock
index 8803bc22398..e15ceaf95eb 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -43,16 +43,16 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
 
 [[package]]
 name = "cranelift-bforest"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 dependencies = [
  "cranelift-entity",
 ]
 
 [[package]]
 name = "cranelift-codegen"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 dependencies = [
  "byteorder",
  "cranelift-bforest",
@@ -69,8 +69,8 @@ dependencies = [
 
 [[package]]
 name = "cranelift-codegen-meta"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 dependencies = [
  "cranelift-codegen-shared",
  "cranelift-entity",
@@ -78,18 +78,18 @@ dependencies = [
 
 [[package]]
 name = "cranelift-codegen-shared"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 
 [[package]]
 name = "cranelift-entity"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 
 [[package]]
 name = "cranelift-frontend"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 dependencies = [
  "cranelift-codegen",
  "log",
@@ -99,8 +99,8 @@ dependencies = [
 
 [[package]]
 name = "cranelift-module"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
@@ -111,8 +111,8 @@ dependencies = [
 
 [[package]]
 name = "cranelift-native"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 dependencies = [
  "cranelift-codegen",
  "raw-cpuid",
@@ -121,26 +121,29 @@ dependencies = [
 
 [[package]]
 name = "cranelift-object"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 dependencies = [
  "anyhow",
  "cranelift-codegen",
  "cranelift-module",
+ "log",
  "object",
  "target-lexicon",
 ]
 
 [[package]]
 name = "cranelift-simplejit"
-version = "0.66.0"
-source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#1fabb051b0436a38f794ca395601dcdcc31d3c18"
+version = "0.67.0"
+source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#88d975d396defb47da85665054a98a16708ef6df"
 dependencies = [
  "cranelift-codegen",
+ "cranelift-entity",
  "cranelift-module",
  "cranelift-native",
  "errno",
  "libc",
+ "log",
  "region",
  "target-lexicon",
  "winapi",
@@ -184,9 +187,9 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
 
 [[package]]
 name = "gimli"
-version = "0.21.0"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
+checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
 dependencies = [
  "indexmap",
 ]
@@ -284,9 +287,9 @@ dependencies = [
 
 [[package]]
 name = "regalloc"
-version = "0.0.30"
+version = "0.0.31"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2041c2d34f6ff346d6f428974f03d8bf12679b0c816bb640dc5eb1d48848d8d1"
+checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5"
 dependencies = [
  "log",
  "rustc-hash",
diff --git a/Cargo.toml b/Cargo.toml
index 86cc6c45019..1c8e350d242 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", bran
 cranelift-simplejit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
 cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
 target-lexicon = "0.11.0"
-gimli = { version = "0.21.0", default-features = false, features = ["write"]}
+gimli = { version = "0.22.0", default-features = false, features = ["write"]}
 object = { version = "0.21.1", default-features = false, features = ["std", "read_core", "write", "coff", "elf", "macho", "pe"] }
 
 ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
diff --git a/src/abi/comments.rs b/src/abi/comments.rs
index f63a4565a72..7bb00c8d46a 100644
--- a/src/abi/comments.rs
+++ b/src/abi/comments.rs
@@ -10,14 +10,14 @@ use cranelift_codegen::entity::EntityRef;
 use crate::abi::pass_mode::*;
 use crate::prelude::*;
 
-pub(super) fn add_args_header_comment(fx: &mut FunctionCx<'_, '_, impl Backend>) {
+pub(super) fn add_args_header_comment(fx: &mut FunctionCx<'_, '_, impl Module>) {
     fx.add_global_comment(format!(
         "kind  loc.idx   param    pass mode                            ty"
     ));
 }
 
 pub(super) fn add_arg_comment<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     kind: &str,
     local: Option<mir::Local>,
     local_field: Option<usize>,
@@ -54,7 +54,7 @@ pub(super) fn add_arg_comment<'tcx>(
     ));
 }
 
-pub(super) fn add_locals_header_comment(fx: &mut FunctionCx<'_, '_, impl Backend>) {
+pub(super) fn add_locals_header_comment(fx: &mut FunctionCx<'_, '_, impl Module>) {
     fx.add_global_comment(String::new());
     fx.add_global_comment(format!(
         "kind  local ty                              size align (abi,pref)"
@@ -62,7 +62,7 @@ pub(super) fn add_locals_header_comment(fx: &mut FunctionCx<'_, '_, impl Backend
 }
 
 pub(super) fn add_local_place_comments<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     place: CPlace<'tcx>,
     local: Local,
 ) {
diff --git a/src/abi/mod.rs b/src/abi/mod.rs
index f55d94b0a09..80169122843 100644
--- a/src/abi/mod.rs
+++ b/src/abi/mod.rs
@@ -238,7 +238,7 @@ pub(crate) fn get_function_name_and_sig<'tcx>(
 /// Instance must be monomorphized
 pub(crate) fn import_function<'tcx>(
     tcx: TyCtxt<'tcx>,
-    module: &mut Module<impl Backend>,
+    module: &mut impl Module,
     inst: Instance<'tcx>,
 ) -> FuncId {
     let (name, sig) = get_function_name_and_sig(tcx, module.isa().triple(), inst, true);
@@ -247,7 +247,7 @@ pub(crate) fn import_function<'tcx>(
         .unwrap()
 }
 
-impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
+impl<'tcx, M: Module> FunctionCx<'_, 'tcx, M> {
     /// Instance must be monomorphized
     pub(crate) fn get_function_ref(&mut self, inst: Instance<'tcx>) -> FuncRef {
         let func_id = import_function(self.tcx, &mut self.cx.module, inst);
@@ -329,7 +329,7 @@ impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
 
 /// Make a [`CPlace`] capable of holding value of the specified type.
 fn make_local_place<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     local: Local,
     layout: TyAndLayout<'tcx>,
     is_ssa: bool,
@@ -351,7 +351,7 @@ fn make_local_place<'tcx>(
 }
 
 pub(crate) fn codegen_fn_prelude<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     start_block: Block,
 ) {
     let ssa_analyzed = crate::analyze::analyze(fx);
@@ -488,7 +488,7 @@ pub(crate) fn codegen_fn_prelude<'tcx>(
 }
 
 pub(crate) fn codegen_terminator_call<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     span: Span,
     current_block: Block,
     func: &Operand<'tcx>,
@@ -701,7 +701,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
 }
 
 pub(crate) fn codegen_drop<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     span: Span,
     drop_place: CPlace<'tcx>,
 ) {
diff --git a/src/abi/pass_mode.rs b/src/abi/pass_mode.rs
index 6033cd88da9..8e3682c86c5 100644
--- a/src/abi/pass_mode.rs
+++ b/src/abi/pass_mode.rs
@@ -122,7 +122,7 @@ pub(super) fn get_pass_mode<'tcx>(tcx: TyCtxt<'tcx>, layout: TyAndLayout<'tcx>)
 
 /// Get a set of values to be passed as function arguments.
 pub(super) fn adjust_arg_for_abi<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     arg: CValue<'tcx>,
 ) -> EmptySinglePair<Value> {
     match get_pass_mode(fx.tcx, arg.layout()) {
@@ -142,7 +142,7 @@ pub(super) fn adjust_arg_for_abi<'tcx>(
 /// Create a [`CValue`] containing the value of a function parameter adding clif function parameters
 /// as necessary.
 pub(super) fn cvalue_for_param<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     start_block: Block,
     #[cfg_attr(not(debug_assertions), allow(unused_variables))] local: Option<mir::Local>,
     #[cfg_attr(not(debug_assertions), allow(unused_variables))] local_field: Option<usize>,
diff --git a/src/abi/returning.rs b/src/abi/returning.rs
index 4505caa67dd..f6d40c880d0 100644
--- a/src/abi/returning.rs
+++ b/src/abi/returning.rs
@@ -3,7 +3,7 @@
 use crate::abi::pass_mode::*;
 use crate::prelude::*;
 
-fn return_layout<'a, 'tcx>(fx: &mut FunctionCx<'a, 'tcx, impl Backend>) -> TyAndLayout<'tcx> {
+fn return_layout<'a, 'tcx>(fx: &mut FunctionCx<'a, 'tcx, impl Module>) -> TyAndLayout<'tcx> {
     fx.layout_of(fx.monomorphize(&fx.mir.local_decls[RETURN_PLACE].ty))
 }
 
@@ -22,7 +22,7 @@ pub(crate) fn can_return_to_ssa_var<'tcx>(
 /// Return a place where the return value of the current function can be written to. If necessary
 /// this adds an extra parameter pointing to where the return value needs to be stored.
 pub(super) fn codegen_return_param<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     ssa_analyzed: &rustc_index::vec::IndexVec<Local, crate::analyze::SsaKind>,
     start_block: Block,
 ) -> CPlace<'tcx> {
@@ -66,11 +66,11 @@ pub(super) fn codegen_return_param<'tcx>(
 
 /// Invokes the closure with if necessary a value representing the return pointer. When the closure
 /// returns the call return value(s) if any are written to the correct place.
-pub(super) fn codegen_with_call_return_arg<'tcx, B: Backend, T>(
-    fx: &mut FunctionCx<'_, 'tcx, B>,
+pub(super) fn codegen_with_call_return_arg<'tcx, M: Module, T>(
+    fx: &mut FunctionCx<'_, 'tcx, M>,
     fn_sig: FnSig<'tcx>,
     ret_place: Option<CPlace<'tcx>>,
-    f: impl FnOnce(&mut FunctionCx<'_, 'tcx, B>, Option<Value>) -> (Inst, T),
+    f: impl FnOnce(&mut FunctionCx<'_, 'tcx, M>, Option<Value>) -> (Inst, T),
 ) -> (Inst, T) {
     let ret_layout = fx.layout_of(fn_sig.output());
 
@@ -110,7 +110,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx, B: Backend, T>(
 }
 
 /// Codegen a return instruction with the right return value(s) if any.
-pub(crate) fn codegen_return(fx: &mut FunctionCx<'_, '_, impl Backend>) {
+pub(crate) fn codegen_return(fx: &mut FunctionCx<'_, '_, impl Module>) {
     match get_pass_mode(fx.tcx, return_layout(fx)) {
         PassMode::NoPass | PassMode::ByRef { size: Some(_) } => {
             fx.bcx.ins().return_(&[]);
diff --git a/src/allocator.rs b/src/allocator.rs
index 2862a372dfe..0735ad6f832 100644
--- a/src/allocator.rs
+++ b/src/allocator.rs
@@ -9,7 +9,7 @@ use rustc_span::symbol::sym;
 /// Returns whether an allocator shim was created
 pub(crate) fn codegen(
     tcx: TyCtxt<'_>,
-    module: &mut Module<impl Backend + 'static>,
+    module: &mut impl Module,
     unwind_context: &mut UnwindContext<'_>,
 ) -> bool {
     let any_dynamic_crate = tcx.dependency_formats(LOCAL_CRATE).iter().any(|(_, list)| {
@@ -27,7 +27,7 @@ pub(crate) fn codegen(
 }
 
 fn codegen_inner(
-    module: &mut Module<impl Backend + 'static>,
+    module: &mut impl Module,
     unwind_context: &mut UnwindContext<'_>,
     kind: AllocatorKind,
 ) {
diff --git a/src/analyze.rs b/src/analyze.rs
index 06434bdf69c..fd25b19a583 100644
--- a/src/analyze.rs
+++ b/src/analyze.rs
@@ -11,7 +11,7 @@ pub(crate) enum SsaKind {
     Ssa,
 }
 
-pub(crate) fn analyze(fx: &FunctionCx<'_, '_, impl Backend>) -> IndexVec<Local, SsaKind> {
+pub(crate) fn analyze(fx: &FunctionCx<'_, '_, impl Module>) -> IndexVec<Local, SsaKind> {
     let mut flag_map = fx
         .mir
         .local_decls
diff --git a/src/atomic_shim.rs b/src/atomic_shim.rs
index f29e269c01f..11b5946b6aa 100644
--- a/src/atomic_shim.rs
+++ b/src/atomic_shim.rs
@@ -11,7 +11,7 @@ pub static mut __cg_clif_global_atomic_mutex: libc::pthread_mutex_t =
     libc::PTHREAD_MUTEX_INITIALIZER;
 
 pub(crate) fn init_global_lock(
-    module: &mut Module<impl Backend>,
+    module: &mut impl Module,
     bcx: &mut FunctionBuilder<'_>,
     use_jit: bool,
 ) {
@@ -24,13 +24,13 @@ pub(crate) fn init_global_lock(
 
     let mut data_ctx = DataContext::new();
     data_ctx.define_zeroinit(1024); // 1024 bytes should be big enough on all platforms.
+    data_ctx.set_align(16);
     let atomic_mutex = module
         .declare_data(
             "__cg_clif_global_atomic_mutex",
             Linkage::Export,
             true,
             false,
-            Some(16),
         )
         .unwrap();
     module.define_data(atomic_mutex, &data_ctx).unwrap();
@@ -67,7 +67,7 @@ pub(crate) fn init_global_lock(
 }
 
 pub(crate) fn init_global_lock_constructor(
-    module: &mut Module<impl Backend>,
+    module: &mut impl Module,
     constructor_name: &str,
 ) -> FuncId {
     let sig = Signature::new(CallConv::SystemV);
@@ -101,7 +101,7 @@ pub(crate) fn init_global_lock_constructor(
     init_func_id
 }
 
-pub(crate) fn lock_global_lock(fx: &mut FunctionCx<'_, '_, impl Backend>) {
+pub(crate) fn lock_global_lock(fx: &mut FunctionCx<'_, '_, impl Module>) {
     let atomic_mutex = fx
         .cx
         .module
@@ -110,7 +110,6 @@ pub(crate) fn lock_global_lock(fx: &mut FunctionCx<'_, '_, impl Backend>) {
             Linkage::Import,
             true,
             false,
-            None,
         )
         .unwrap();
 
@@ -144,7 +143,7 @@ pub(crate) fn lock_global_lock(fx: &mut FunctionCx<'_, '_, impl Backend>) {
     fx.bcx.ins().call(pthread_mutex_lock, &[atomic_mutex]);
 }
 
-pub(crate) fn unlock_global_lock(fx: &mut FunctionCx<'_, '_, impl Backend>) {
+pub(crate) fn unlock_global_lock(fx: &mut FunctionCx<'_, '_, impl Module>) {
     let atomic_mutex = fx
         .cx
         .module
@@ -153,7 +152,6 @@ pub(crate) fn unlock_global_lock(fx: &mut FunctionCx<'_, '_, impl Backend>) {
             Linkage::Import,
             true,
             false,
-            None,
         )
         .unwrap();
 
diff --git a/src/backend.rs b/src/backend.rs
index f6c06f7f88e..c0df85f681c 100644
--- a/src/backend.rs
+++ b/src/backend.rs
@@ -5,12 +5,12 @@ use std::convert::{TryFrom, TryInto};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_session::Session;
 
-use cranelift_module::{FuncId, Module};
+use cranelift_module::FuncId;
 
 use object::write::*;
 use object::{RelocationEncoding, RelocationKind, SectionKind, SymbolFlags};
 
-use cranelift_object::{ObjectBackend, ObjectBuilder, ObjectProduct};
+use cranelift_object::{ObjectBuilder, ObjectModule, ObjectProduct};
 
 use gimli::SectionId;
 
@@ -71,16 +71,18 @@ impl WriteDebugInfo for ObjectProduct {
 
         let segment = self.object.segment_name(StandardSegment::Debug).to_vec();
         // FIXME use SHT_X86_64_UNWIND for .eh_frame
-        let section_id = self.object.add_section(segment, name.clone(), if id == SectionId::EhFrame {
-            SectionKind::ReadOnlyData
-        } else {
-            SectionKind::Debug
-        });
-        self.object.section_mut(section_id).set_data(data, if id == SectionId::EhFrame {
-            8
-        } else {
-            1
-        });
+        let section_id = self.object.add_section(
+            segment,
+            name.clone(),
+            if id == SectionId::EhFrame {
+                SectionKind::ReadOnlyData
+            } else {
+                SectionKind::Debug
+            },
+        );
+        self.object
+            .section_mut(section_id)
+            .set_data(data, if id == SectionId::EhFrame { 8 } else { 1 });
         let symbol_id = self.object.section_symbol(section_id);
         (section_id, symbol_id)
     }
@@ -153,16 +155,6 @@ impl AddConstructor for ObjectProduct {
     }
 }
 
-pub(crate) trait Emit {
-    fn emit(self) -> Vec<u8>;
-}
-
-impl Emit for ObjectProduct {
-    fn emit(self) -> Vec<u8> {
-        self.object.write().unwrap()
-    }
-}
-
 pub(crate) fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Object)) -> Vec<u8> {
     let triple = crate::build_isa(sess, true).triple().clone();
 
@@ -193,10 +185,7 @@ pub(crate) fn with_object(sess: &Session, name: &str, f: impl FnOnce(&mut Object
     metadata_object.write().unwrap()
 }
 
-pub(crate) type Backend =
-    impl cranelift_module::Backend<Product: AddConstructor + Emit + WriteDebugInfo>;
-
-pub(crate) fn make_module(sess: &Session, name: String) -> Module<Backend> {
+pub(crate) fn make_module(sess: &Session, name: String) -> ObjectModule {
     let mut builder = ObjectBuilder::new(
         crate::build_isa(sess, true),
         name + ".o",
@@ -206,8 +195,6 @@ pub(crate) fn make_module(sess: &Session, name: String) -> Module<Backend> {
     if std::env::var("CG_CLIF_FUNCTION_SECTIONS").is_ok() {
         builder.per_function_section(true);
     }
-    let module: Module<ObjectBackend> = Module::new(
-        builder,
-    );
+    let module = ObjectModule::new(builder);
     module
 }
diff --git a/src/base.rs b/src/base.rs
index d1b97420aa2..9f558bc7520 100644
--- a/src/base.rs
+++ b/src/base.rs
@@ -5,8 +5,8 @@ use rustc_middle::ty::adjustment::PointerCast;
 
 use crate::prelude::*;
 
-pub(crate) fn trans_fn<'tcx, B: Backend + 'static>(
-    cx: &mut crate::CodegenCx<'tcx, B>,
+pub(crate) fn trans_fn<'tcx>(
+    cx: &mut crate::CodegenCx<'tcx, impl Module>,
     instance: Instance<'tcx>,
     linkage: Linkage,
 ) {
@@ -183,7 +183,7 @@ pub(crate) fn verify_func(
     });
 }
 
-fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
+fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Module>) {
     crate::constant::check_constants(fx);
 
     for (bb, bb_data) in fx.mir.basic_blocks().iter_enumerated() {
@@ -417,7 +417,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
 }
 
 fn trans_stmt<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     #[allow(unused_variables)] cur_block: Block,
     stmt: &Statement<'tcx>,
 ) {
@@ -543,7 +543,7 @@ fn trans_stmt<'tcx>(
                     let to_ty = fx.monomorphize(to_ty);
 
                     fn is_fat_ptr<'tcx>(
-                        fx: &FunctionCx<'_, 'tcx, impl Backend>,
+                        fx: &FunctionCx<'_, 'tcx, impl Module>,
                         ty: Ty<'tcx>,
                     ) -> bool {
                         ty.builtin_deref(true)
@@ -873,7 +873,7 @@ fn trans_stmt<'tcx>(
 }
 
 fn codegen_array_len<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     place: CPlace<'tcx>,
 ) -> Value {
     match *place.layout().ty.kind() {
@@ -893,7 +893,7 @@ fn codegen_array_len<'tcx>(
 }
 
 pub(crate) fn trans_place<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     place: Place<'tcx>,
 ) -> CPlace<'tcx> {
     let mut cplace = fx.get_local_place(place.local);
@@ -965,7 +965,7 @@ pub(crate) fn trans_place<'tcx>(
 }
 
 pub(crate) fn trans_operand<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     operand: &Operand<'tcx>,
 ) -> CValue<'tcx> {
     match operand {
@@ -978,7 +978,7 @@ pub(crate) fn trans_operand<'tcx>(
 }
 
 pub(crate) fn codegen_panic<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     msg_str: &str,
     span: Span,
 ) {
@@ -995,7 +995,7 @@ pub(crate) fn codegen_panic<'tcx>(
 }
 
 pub(crate) fn codegen_panic_inner<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     lang_item: rustc_hir::LangItem,
     args: &[Value],
     span: Span,
diff --git a/src/cast.rs b/src/cast.rs
index edfe6feb6c8..122a36b5bf7 100644
--- a/src/cast.rs
+++ b/src/cast.rs
@@ -3,7 +3,7 @@
 use crate::prelude::*;
 
 pub(crate) fn clif_intcast(
-    fx: &mut FunctionCx<'_, '_, impl Backend>,
+    fx: &mut FunctionCx<'_, '_, impl Module>,
     val: Value,
     to: Type,
     signed: bool,
@@ -51,7 +51,7 @@ pub(crate) fn clif_intcast(
 }
 
 pub(crate) fn clif_int_or_float_cast(
-    fx: &mut FunctionCx<'_, '_, impl Backend>,
+    fx: &mut FunctionCx<'_, '_, impl Module>,
     from: Value,
     from_signed: bool,
     to_ty: Type,
diff --git a/src/codegen_i128.rs b/src/codegen_i128.rs
index 99bd526ad01..e998403dea6 100644
--- a/src/codegen_i128.rs
+++ b/src/codegen_i128.rs
@@ -3,7 +3,7 @@
 use crate::prelude::*;
 
 pub(crate) fn maybe_codegen<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     bin_op: BinOp,
     checked: bool,
     lhs: CValue<'tcx>,
diff --git a/src/common.rs b/src/common.rs
index d1375c73a4b..0f22f900ca7 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -131,7 +131,7 @@ pub(crate) fn has_ptr_meta<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
 }
 
 pub(crate) fn codegen_icmp_imm(
-    fx: &mut FunctionCx<'_, '_, impl Backend>,
+    fx: &mut FunctionCx<'_, '_, impl Module>,
     intcc: IntCC,
     lhs: Value,
     rhs: i128,
@@ -287,8 +287,8 @@ pub(crate) fn type_sign(ty: Ty<'_>) -> bool {
     }
 }
 
-pub(crate) struct FunctionCx<'clif, 'tcx, B: Backend + 'static> {
-    pub(crate) cx: &'clif mut crate::CodegenCx<'tcx, B>,
+pub(crate) struct FunctionCx<'clif, 'tcx, M: Module> {
+    pub(crate) cx: &'clif mut crate::CodegenCx<'tcx, M>,
     pub(crate) tcx: TyCtxt<'tcx>,
     pub(crate) pointer_type: Type, // Cached from module
 
@@ -314,7 +314,7 @@ pub(crate) struct FunctionCx<'clif, 'tcx, B: Backend + 'static> {
     pub(crate) inline_asm_index: u32,
 }
 
-impl<'tcx, B: Backend> LayoutOf for FunctionCx<'_, 'tcx, B> {
+impl<'tcx, M: Module> LayoutOf for FunctionCx<'_, 'tcx, M> {
     type Ty = Ty<'tcx>;
     type TyAndLayout = TyAndLayout<'tcx>;
 
@@ -332,31 +332,31 @@ impl<'tcx, B: Backend> LayoutOf for FunctionCx<'_, 'tcx, B> {
     }
 }
 
-impl<'tcx, B: Backend + 'static> layout::HasTyCtxt<'tcx> for FunctionCx<'_, 'tcx, B> {
+impl<'tcx, M: Module> layout::HasTyCtxt<'tcx> for FunctionCx<'_, 'tcx, M> {
     fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
         self.tcx
     }
 }
 
-impl<'tcx, B: Backend + 'static> rustc_target::abi::HasDataLayout for FunctionCx<'_, 'tcx, B> {
+impl<'tcx, M: Module> rustc_target::abi::HasDataLayout for FunctionCx<'_, 'tcx, M> {
     fn data_layout(&self) -> &rustc_target::abi::TargetDataLayout {
         &self.tcx.data_layout
     }
 }
 
-impl<'tcx, B: Backend + 'static> layout::HasParamEnv<'tcx> for FunctionCx<'_, 'tcx, B> {
+impl<'tcx, M: Module> layout::HasParamEnv<'tcx> for FunctionCx<'_, 'tcx, M> {
     fn param_env(&self) -> ParamEnv<'tcx> {
         ParamEnv::reveal_all()
     }
 }
 
-impl<'tcx, B: Backend + 'static> HasTargetSpec for FunctionCx<'_, 'tcx, B> {
+impl<'tcx, M: Module> HasTargetSpec for FunctionCx<'_, 'tcx, M> {
     fn target_spec(&self) -> &Target {
         &self.tcx.sess.target.target
     }
 }
 
-impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
+impl<'tcx, M: Module> FunctionCx<'_, 'tcx, M> {
     pub(crate) fn monomorphize<T>(&self, value: &T) -> T
     where
         T: TypeFoldable<'tcx> + Copy,
@@ -430,7 +430,6 @@ impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
                 Linkage::Local,
                 false,
                 false,
-                None,
             )
             .unwrap();
 
diff --git a/src/constant.rs b/src/constant.rs
index 2c4d9b8f177..d6d38a4b3ad 100644
--- a/src/constant.rs
+++ b/src/constant.rs
@@ -9,7 +9,6 @@ use rustc_middle::mir::interpret::{
     read_target_uint, AllocId, Allocation, ConstValue, ErrorHandled, GlobalAlloc, Pointer, Scalar,
 };
 use rustc_middle::ty::{Const, ConstKind};
-use rustc_target::abi::Align;
 
 use cranelift_codegen::ir::GlobalValueData;
 use cranelift_module::*;
@@ -29,7 +28,7 @@ enum TodoItem {
 }
 
 impl ConstantCx {
-    pub(crate) fn finalize(mut self, tcx: TyCtxt<'_>, module: &mut Module<impl Backend>) {
+    pub(crate) fn finalize(mut self, tcx: TyCtxt<'_>, module: &mut impl Module) {
         //println!("todo {:?}", self.todo);
         define_all_allocs(tcx, module, &mut self);
         //println!("done {:?}", self.done);
@@ -37,7 +36,7 @@ impl ConstantCx {
     }
 }
 
-pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, impl Backend>) {
+pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, impl Module>) {
     for constant in &fx.mir.required_consts {
         let const_ = fx.monomorphize(&constant.literal);
         match const_.val {
@@ -77,7 +76,7 @@ pub(crate) fn codegen_static(constants_cx: &mut ConstantCx, def_id: DefId) {
 }
 
 pub(crate) fn codegen_tls_ref<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     def_id: DefId,
     layout: TyAndLayout<'tcx>,
 ) -> CValue<'tcx> {
@@ -90,7 +89,7 @@ pub(crate) fn codegen_tls_ref<'tcx>(
 }
 
 fn codegen_static_ref<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     def_id: DefId,
     layout: TyAndLayout<'tcx>,
 ) -> CPlace<'tcx> {
@@ -108,7 +107,7 @@ fn codegen_static_ref<'tcx>(
 }
 
 pub(crate) fn trans_constant<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     constant: &Constant<'tcx>,
 ) -> CValue<'tcx> {
     let const_ = fx.monomorphize(&constant.literal);
@@ -156,7 +155,7 @@ pub(crate) fn trans_constant<'tcx>(
 }
 
 pub(crate) fn trans_const_value<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     const_val: ConstValue<'tcx>,
     ty: Ty<'tcx>,
 ) -> CValue<'tcx> {
@@ -199,7 +198,6 @@ pub(crate) fn trans_const_value<'tcx>(
                             let data_id = data_id_for_alloc_id(
                                 &mut fx.cx.module,
                                 ptr.alloc_id,
-                                alloc.align,
                                 alloc.mutability,
                             );
                             let local_data_id =
@@ -254,12 +252,12 @@ pub(crate) fn trans_const_value<'tcx>(
 }
 
 fn pointer_for_allocation<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     alloc: &'tcx Allocation,
 ) -> crate::pointer::Pointer {
     let alloc_id = fx.tcx.create_memory_alloc(alloc);
     fx.cx.constants_cx.todo.push(TodoItem::Alloc(alloc_id));
-    let data_id = data_id_for_alloc_id(&mut fx.cx.module, alloc_id, alloc.align, alloc.mutability);
+    let data_id = data_id_for_alloc_id(&mut fx.cx.module, alloc_id, alloc.mutability);
 
     let local_data_id = fx.cx.module.declare_data_in_func(data_id, &mut fx.bcx.func);
     #[cfg(debug_assertions)]
@@ -268,10 +266,9 @@ fn pointer_for_allocation<'tcx>(
     crate::pointer::Pointer::new(global_ptr)
 }
 
-fn data_id_for_alloc_id<B: Backend>(
-    module: &mut Module<B>,
+fn data_id_for_alloc_id(
+    module: &mut impl Module,
     alloc_id: AllocId,
-    align: Align,
     mutability: rustc_hir::Mutability,
 ) -> DataId {
     module
@@ -280,14 +277,13 @@ fn data_id_for_alloc_id<B: Backend>(
             Linkage::Local,
             mutability == rustc_hir::Mutability::Mut,
             false,
-            Some(align.bytes() as u8),
         )
         .unwrap()
 }
 
 fn data_id_for_static(
     tcx: TyCtxt<'_>,
-    module: &mut Module<impl Backend>,
+    module: &mut impl Module,
     def_id: DefId,
     definition: bool,
 ) -> DataId {
@@ -327,7 +323,6 @@ fn data_id_for_static(
             linkage,
             is_mutable,
             attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL),
-            Some(align.try_into().unwrap()),
         )
         .unwrap();
 
@@ -342,15 +337,10 @@ fn data_id_for_static(
 
         let ref_name = format!("_rust_extern_with_linkage_{}", symbol_name);
         let ref_data_id = module
-            .declare_data(
-                &ref_name,
-                Linkage::Local,
-                true,
-                false,
-                Some(align.try_into().unwrap()),
-            )
+            .declare_data(&ref_name, Linkage::Local, true, false)
             .unwrap();
         let mut data_ctx = DataContext::new();
+        data_ctx.set_align(align);
         let data = module.declare_data_in_data(data_id, &mut data_ctx);
         data_ctx.define(
             std::iter::repeat(0)
@@ -370,7 +360,7 @@ fn data_id_for_static(
     }
 }
 
-fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module<impl Backend>, cx: &mut ConstantCx) {
+fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut impl Module, cx: &mut ConstantCx) {
     while let Some(todo_item) = cx.todo.pop() {
         let (data_id, alloc, section_name) = match todo_item {
             TodoItem::Alloc(alloc_id) => {
@@ -379,7 +369,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module<impl Backend>, cx: &mu
                     GlobalAlloc::Memory(alloc) => alloc,
                     GlobalAlloc::Function(_) | GlobalAlloc::Static(_) => unreachable!(),
                 };
-                let data_id = data_id_for_alloc_id(module, alloc_id, alloc.align, alloc.mutability);
+                let data_id = data_id_for_alloc_id(module, alloc_id, alloc.mutability);
                 (data_id, alloc, None)
             }
             TodoItem::Static(def_id) => {
@@ -403,6 +393,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module<impl Backend>, cx: &mu
         }
 
         let mut data_ctx = DataContext::new();
+        data_ctx.set_align(alloc.align.bytes());
 
         if let Some(section_name) = section_name {
             // FIXME set correct segment for Mach-O files
@@ -436,7 +427,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module<impl Backend>, cx: &mu
                 }
                 GlobalAlloc::Memory(target_alloc) => {
                     cx.todo.push(TodoItem::Alloc(reloc));
-                    data_id_for_alloc_id(module, reloc, target_alloc.align, target_alloc.mutability)
+                    data_id_for_alloc_id(module, reloc, target_alloc.mutability)
                 }
                 GlobalAlloc::Static(def_id) => {
                     if tcx
@@ -469,7 +460,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module<impl Backend>, cx: &mu
 }
 
 pub(crate) fn mir_operand_get_const_val<'tcx>(
-    fx: &FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &FunctionCx<'_, 'tcx, impl Module>,
     operand: &Operand<'tcx>,
 ) -> Option<&'tcx Const<'tcx>> {
     match operand {
diff --git a/src/debuginfo/emit.rs b/src/debuginfo/emit.rs
index 0a887e8cb59..3ad52c2e873 100644
--- a/src/debuginfo/emit.rs
+++ b/src/debuginfo/emit.rs
@@ -76,7 +76,7 @@ impl WriterRelocate {
     #[cfg(feature = "jit")]
     pub(super) fn relocate_for_jit(
         mut self,
-        jit_module: &mut cranelift_module::Module<cranelift_simplejit::SimpleJITBackend>,
+        jit_product: &cranelift_simplejit::SimpleJITProduct,
     ) -> Vec<u8> {
         use std::convert::TryInto;
 
@@ -84,7 +84,7 @@ impl WriterRelocate {
             match reloc.name {
                 super::DebugRelocName::Section(_) => unreachable!(),
                 super::DebugRelocName::Symbol(sym) => {
-                    let addr = jit_module.get_finalized_function(
+                    let addr = jit_product.lookup_func(
                         cranelift_module::FuncId::from_u32(sym.try_into().unwrap()),
                     );
                     let val = (addr as u64 as i64 + reloc.addend) as u64;
diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs
index 9cad668e3f6..f33aa6683a7 100644
--- a/src/debuginfo/mod.rs
+++ b/src/debuginfo/mod.rs
@@ -336,6 +336,8 @@ impl<'tcx> DebugContext<'tcx> {
                 | ArgumentPurpose::CalleeSaved => continue,
                 ArgumentPurpose::VMContext
                 | ArgumentPurpose::SignatureId
+                | ArgumentPurpose::CallerTLS
+                | ArgumentPurpose::CalleeTLS
                 | ArgumentPurpose::StackLimit => unreachable!(),
             };
             let name = format!("{}{}", base_name, i);
diff --git a/src/debuginfo/unwind.rs b/src/debuginfo/unwind.rs
index fa1a9d44117..f08dfb60769 100644
--- a/src/debuginfo/unwind.rs
+++ b/src/debuginfo/unwind.rs
@@ -78,7 +78,7 @@ impl<'tcx> UnwindContext<'tcx> {
     #[cfg(feature = "jit")]
     pub(crate) unsafe fn register_jit(
         self,
-        jit_module: &mut Module<cranelift_simplejit::SimpleJITBackend>,
+        jit_product: &cranelift_simplejit::SimpleJITProduct,
     ) -> Option<UnwindRegistry> {
         let mut eh_frame = EhFrame::from(super::emit::WriterRelocate::new(super::target_endian(
             self.tcx,
@@ -89,7 +89,7 @@ impl<'tcx> UnwindContext<'tcx> {
             return None;
         }
 
-        let mut eh_frame = eh_frame.0.relocate_for_jit(jit_module);
+        let mut eh_frame = eh_frame.0.relocate_for_jit(jit_product);
 
         // GCC expects a terminating "empty" length, so write a 0 length at the end of the table.
         eh_frame.extend(&[0, 0, 0, 0]);
diff --git a/src/discriminant.rs b/src/discriminant.rs
index 231802dfb85..d15bc36ad05 100644
--- a/src/discriminant.rs
+++ b/src/discriminant.rs
@@ -7,7 +7,7 @@ use rustc_target::abi::{Int, TagEncoding, Variants};
 use crate::prelude::*;
 
 pub(crate) fn codegen_set_discriminant<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     place: CPlace<'tcx>,
     variant_index: VariantIdx,
 ) {
@@ -57,7 +57,7 @@ pub(crate) fn codegen_set_discriminant<'tcx>(
 }
 
 pub(crate) fn codegen_get_discriminant<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     value: CValue<'tcx>,
     dest_layout: TyAndLayout<'tcx>,
 ) -> CValue<'tcx> {
diff --git a/src/driver/aot.rs b/src/driver/aot.rs
index fc01398c40d..2b3d1b7885d 100644
--- a/src/driver/aot.rs
+++ b/src/driver/aot.rs
@@ -12,11 +12,13 @@ use rustc_middle::mir::mono::CodegenUnit;
 use rustc_session::cgu_reuse_tracker::CguReuse;
 use rustc_session::config::{DebugInfo, OutputType};
 
+use cranelift_object::{ObjectModule, ObjectProduct};
+
 use crate::prelude::*;
 
-use crate::backend::{AddConstructor, Emit, WriteDebugInfo};
+use crate::backend::AddConstructor;
 
-fn new_module(tcx: TyCtxt<'_>, name: String) -> Module<crate::backend::Backend> {
+fn new_module(tcx: TyCtxt<'_>, name: String) -> ObjectModule {
     let module = crate::backend::make_module(tcx.sess, name);
     assert_eq!(pointer_ty(tcx), module.target_config().pointer_type());
     module
@@ -30,19 +32,15 @@ impl<HCX> HashStable<HCX> for ModuleCodegenResult {
     }
 }
 
-fn emit_module<B: Backend>(
+fn emit_module(
     tcx: TyCtxt<'_>,
     name: String,
     kind: ModuleKind,
-    mut module: Module<B>,
+    module: ObjectModule,
     debug: Option<DebugContext<'_>>,
     unwind_context: UnwindContext<'_>,
-    map_product: impl FnOnce(B::Product) -> B::Product,
-) -> ModuleCodegenResult
-where
-    B::Product: AddConstructor + Emit + WriteDebugInfo,
-{
-    module.finalize_definitions();
+    map_product: impl FnOnce(ObjectProduct) -> ObjectProduct,
+) -> ModuleCodegenResult {
     let mut product = module.finish();
 
     if let Some(mut debug) = debug {
@@ -56,7 +54,7 @@ where
     let tmp_file = tcx
         .output_filenames(LOCAL_CRATE)
         .temp_path(OutputType::Object, Some(&name));
-    let obj = product.emit();
+    let obj = product.object.write().unwrap();
     if let Err(err) = std::fs::write(&tmp_file, obj) {
         tcx.sess
             .fatal(&format!("error writing object file: {}", err));
diff --git a/src/driver/jit.rs b/src/driver/jit.rs
index 5a899afb97c..611a70eae2b 100644
--- a/src/driver/jit.rs
+++ b/src/driver/jit.rs
@@ -9,7 +9,7 @@ use rustc_codegen_ssa::CrateInfo;
 use crate::prelude::*;
 
 pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
-    use cranelift_simplejit::{SimpleJITBackend, SimpleJITBuilder};
+    use cranelift_simplejit::{SimpleJITModule, SimpleJITBuilder};
 
     #[cfg(unix)]
     unsafe {
@@ -36,7 +36,7 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
         cranelift_module::default_libcall_names(),
     );
     jit_builder.symbols(imported_symbols);
-    let mut jit_module: Module<SimpleJITBackend> = Module::new(jit_builder);
+    let mut jit_module = SimpleJITModule::new(jit_builder);
     assert_eq!(pointer_ty(tcx), jit_module.target_config().pointer_type());
 
     let sig = Signature {
@@ -79,13 +79,13 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
     crate::main_shim::maybe_create_entry_wrapper(tcx, &mut jit_module, &mut unwind_context, true);
     crate::allocator::codegen(tcx, &mut jit_module, &mut unwind_context);
 
-    jit_module.finalize_definitions();
+    let jit_product = jit_module.finish();
 
-    let _unwind_register_guard = unsafe { unwind_context.register_jit(&mut jit_module) };
+    let _unwind_register_guard = unsafe { unwind_context.register_jit(&jit_product) };
 
     tcx.sess.abort_if_errors();
 
-    let finalized_main: *const u8 = jit_module.get_finalized_function(main_func_id);
+    let finalized_main: *const u8 = jit_product.lookup_func(main_func_id);
 
     println!("Rustc codegen cranelift will JIT run the executable, because --jit was passed");
 
@@ -105,7 +105,6 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
 
     let ret = f(args.len() as c_int, argv.as_ptr());
 
-    jit_module.finish();
     std::process::exit(ret);
 }
 
diff --git a/src/driver/mod.rs b/src/driver/mod.rs
index 881221c0105..c32c4792519 100644
--- a/src/driver/mod.rs
+++ b/src/driver/mod.rs
@@ -41,7 +41,7 @@ pub(crate) fn codegen_crate(
 }
 
 fn codegen_mono_items<'tcx>(
-    cx: &mut crate::CodegenCx<'tcx, impl Backend + 'static>,
+    cx: &mut crate::CodegenCx<'tcx, impl Module>,
     mono_items: Vec<(MonoItem<'tcx>, (RLinkage, Visibility))>,
 ) {
     cx.tcx.sess.time("predefine functions", || {
@@ -68,8 +68,8 @@ fn codegen_mono_items<'tcx>(
     }
 }
 
-fn trans_mono_item<'tcx, B: Backend + 'static>(
-    cx: &mut crate::CodegenCx<'tcx, B>,
+fn trans_mono_item<'tcx, M: Module>(
+    cx: &mut crate::CodegenCx<'tcx, M>,
     mono_item: MonoItem<'tcx>,
     linkage: Linkage,
 ) {
diff --git a/src/inline_asm.rs b/src/inline_asm.rs
index e11ba4a4f63..aa2edb2dfd4 100644
--- a/src/inline_asm.rs
+++ b/src/inline_asm.rs
@@ -9,7 +9,7 @@ use rustc_middle::mir::InlineAsmOperand;
 use rustc_target::asm::*;
 
 pub(crate) fn codegen_inline_asm<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     _span: Span,
     template: &[InlineAsmTemplatePiece],
     operands: &[InlineAsmOperand<'tcx>],
@@ -203,7 +203,7 @@ fn generate_asm_wrapper(
 }
 
 fn call_inline_asm<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     asm_name: &str,
     slot_size: Size,
     inputs: Vec<(InlineAsmReg, Size, Value)>,
diff --git a/src/intrinsics/cpuid.rs b/src/intrinsics/cpuid.rs
index 94c280ee0ba..c1a1cdbe4eb 100644
--- a/src/intrinsics/cpuid.rs
+++ b/src/intrinsics/cpuid.rs
@@ -6,7 +6,7 @@ use crate::prelude::*;
 ///
 /// This emulates an intel cpu with sse and sse2 support, but which doesn't support anything else.
 pub(crate) fn codegen_cpuid_call<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     leaf: Value,
     _subleaf: Value,
 ) -> (Value, Value, Value, Value) {
diff --git a/src/intrinsics/llvm.rs b/src/intrinsics/llvm.rs
index 8bd744dbc35..18d86f0c5f9 100644
--- a/src/intrinsics/llvm.rs
+++ b/src/intrinsics/llvm.rs
@@ -6,7 +6,7 @@ use crate::prelude::*;
 use rustc_middle::ty::subst::SubstsRef;
 
 pub(crate) fn codegen_llvm_intrinsic_call<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     intrinsic: &str,
     substs: SubstsRef<'tcx>,
     args: &[mir::Operand<'tcx>],
diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs
index e75e83b56d6..9a3e4c7b56e 100644
--- a/src/intrinsics/mod.rs
+++ b/src/intrinsics/mod.rs
@@ -204,12 +204,12 @@ pub(crate) fn clif_vector_type<'tcx>(tcx: TyCtxt<'tcx>, layout: TyAndLayout<'tcx
     }
 }
 
-fn simd_for_each_lane<'tcx, B: Backend>(
-    fx: &mut FunctionCx<'_, 'tcx, B>,
+fn simd_for_each_lane<'tcx, M: Module>(
+    fx: &mut FunctionCx<'_, 'tcx, M>,
     val: CValue<'tcx>,
     ret: CPlace<'tcx>,
     f: impl Fn(
-        &mut FunctionCx<'_, 'tcx, B>,
+        &mut FunctionCx<'_, 'tcx, M>,
         TyAndLayout<'tcx>,
         TyAndLayout<'tcx>,
         Value,
@@ -231,13 +231,13 @@ fn simd_for_each_lane<'tcx, B: Backend>(
     }
 }
 
-fn simd_pair_for_each_lane<'tcx, B: Backend>(
-    fx: &mut FunctionCx<'_, 'tcx, B>,
+fn simd_pair_for_each_lane<'tcx, M: Module>(
+    fx: &mut FunctionCx<'_, 'tcx, M>,
     x: CValue<'tcx>,
     y: CValue<'tcx>,
     ret: CPlace<'tcx>,
     f: impl Fn(
-        &mut FunctionCx<'_, 'tcx, B>,
+        &mut FunctionCx<'_, 'tcx, M>,
         TyAndLayout<'tcx>,
         TyAndLayout<'tcx>,
         Value,
@@ -263,7 +263,7 @@ fn simd_pair_for_each_lane<'tcx, B: Backend>(
 }
 
 fn bool_to_zero_or_max_uint<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     layout: TyAndLayout<'tcx>,
     val: Value,
 ) -> CValue<'tcx> {
@@ -395,7 +395,7 @@ macro simd_flt_binop($fx:expr, $op:ident($x:ident, $y:ident) -> $ret:ident) {
 }
 
 pub(crate) fn codegen_intrinsic_call<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     instance: Instance<'tcx>,
     args: &[mir::Operand<'tcx>],
     destination: Option<(CPlace<'tcx>, BasicBlock)>,
diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs
index 93724522e76..e9d3cc8d256 100644
--- a/src/intrinsics/simd.rs
+++ b/src/intrinsics/simd.rs
@@ -4,7 +4,7 @@ use super::*;
 use crate::prelude::*;
 
 pub(super) fn codegen_simd_intrinsic_call<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     instance: Instance<'tcx>,
     args: &[mir::Operand<'tcx>],
     ret: CPlace<'tcx>,
diff --git a/src/lib.rs b/src/lib.rs
index e3a632fc465..c10eeb7bf88 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -108,9 +108,7 @@ mod prelude {
     pub(crate) use cranelift_codegen::isa::{self, CallConv};
     pub(crate) use cranelift_codegen::Context;
     pub(crate) use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable};
-    pub(crate) use cranelift_module::{
-        self, Backend, DataContext, DataId, FuncId, Linkage, Module,
-    };
+    pub(crate) use cranelift_module::{self, DataContext, DataId, FuncId, Linkage, Module};
 
     pub(crate) use crate::abi::*;
     pub(crate) use crate::base::{trans_operand, trans_place};
@@ -131,9 +129,9 @@ impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
     }
 }
 
-struct CodegenCx<'tcx, B: Backend + 'static> {
+struct CodegenCx<'tcx, M: Module> {
     tcx: TyCtxt<'tcx>,
-    module: Module<B>,
+    module: M,
     global_asm: String,
     constants_cx: ConstantCx,
     cached_context: Context,
@@ -142,8 +140,8 @@ struct CodegenCx<'tcx, B: Backend + 'static> {
     unwind_context: UnwindContext<'tcx>,
 }
 
-impl<'tcx, B: Backend + 'static> CodegenCx<'tcx, B> {
-    fn new(tcx: TyCtxt<'tcx>, module: Module<B>, debug_info: bool) -> Self {
+impl<'tcx, M: Module> CodegenCx<'tcx, M> {
+    fn new(tcx: TyCtxt<'tcx>, module: M, debug_info: bool) -> Self {
         let unwind_context = UnwindContext::new(tcx, module.isa());
         let debug_context = if debug_info {
             Some(DebugContext::new(tcx, module.isa()))
@@ -162,14 +160,7 @@ impl<'tcx, B: Backend + 'static> CodegenCx<'tcx, B> {
         }
     }
 
-    fn finalize(
-        mut self,
-    ) -> (
-        Module<B>,
-        String,
-        Option<DebugContext<'tcx>>,
-        UnwindContext<'tcx>,
-    ) {
+    fn finalize(mut self) -> (M, String, Option<DebugContext<'tcx>>, UnwindContext<'tcx>) {
         self.constants_cx.finalize(self.tcx, &mut self.module);
         (
             self.module,
@@ -352,8 +343,6 @@ fn build_isa(sess: &Session, enable_pic: bool) -> Box<dyn isa::TargetIsa + 'stat
 #[no_mangle]
 pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
     Box::new(CraneliftCodegenBackend {
-        config: BackendConfig {
-            use_jit: false,
-        }
+        config: BackendConfig { use_jit: false },
     })
 }
diff --git a/src/main_shim.rs b/src/main_shim.rs
index c4b21dcecd3..db34d89fe2b 100644
--- a/src/main_shim.rs
+++ b/src/main_shim.rs
@@ -7,7 +7,7 @@ use crate::prelude::*;
 /// users main function.
 pub(crate) fn maybe_create_entry_wrapper(
     tcx: TyCtxt<'_>,
-    module: &mut Module<impl Backend + 'static>,
+    module: &mut impl Module,
     unwind_context: &mut UnwindContext<'_>,
     use_jit: bool,
 ) {
@@ -38,7 +38,7 @@ pub(crate) fn maybe_create_entry_wrapper(
 
     fn create_entry_fn(
         tcx: TyCtxt<'_>,
-        m: &mut Module<impl Backend + 'static>,
+        m: &mut impl Module,
         unwind_context: &mut UnwindContext<'_>,
         rust_main_def_id: DefId,
         use_start_lang_item: bool,
diff --git a/src/num.rs b/src/num.rs
index 4e3b79cd2d6..b37826d71f4 100644
--- a/src/num.rs
+++ b/src/num.rs
@@ -41,7 +41,7 @@ pub(crate) fn bin_op_to_intcc(bin_op: BinOp, signed: bool) -> Option<IntCC> {
 }
 
 fn codegen_compare_bin_op<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     bin_op: BinOp,
     signed: bool,
     lhs: Value,
@@ -54,7 +54,7 @@ fn codegen_compare_bin_op<'tcx>(
 }
 
 pub(crate) fn codegen_binop<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     bin_op: BinOp,
     in_lhs: CValue<'tcx>,
     in_rhs: CValue<'tcx>,
@@ -103,7 +103,7 @@ pub(crate) fn codegen_binop<'tcx>(
 }
 
 pub(crate) fn trans_bool_binop<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     bin_op: BinOp,
     in_lhs: CValue<'tcx>,
     in_rhs: CValue<'tcx>,
@@ -124,7 +124,7 @@ pub(crate) fn trans_bool_binop<'tcx>(
 }
 
 pub(crate) fn trans_int_binop<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     bin_op: BinOp,
     in_lhs: CValue<'tcx>,
     in_rhs: CValue<'tcx>,
@@ -197,7 +197,7 @@ pub(crate) fn trans_int_binop<'tcx>(
 }
 
 pub(crate) fn trans_checked_int_binop<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     bin_op: BinOp,
     in_lhs: CValue<'tcx>,
     in_rhs: CValue<'tcx>,
@@ -358,7 +358,7 @@ pub(crate) fn trans_checked_int_binop<'tcx>(
 }
 
 pub(crate) fn trans_float_binop<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     bin_op: BinOp,
     in_lhs: CValue<'tcx>,
     in_rhs: CValue<'tcx>,
@@ -403,7 +403,7 @@ pub(crate) fn trans_float_binop<'tcx>(
 }
 
 pub(crate) fn trans_ptr_binop<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     bin_op: BinOp,
     in_lhs: CValue<'tcx>,
     in_rhs: CValue<'tcx>,
diff --git a/src/pointer.rs b/src/pointer.rs
index cd3f27c3247..b2036d7bcd4 100644
--- a/src/pointer.rs
+++ b/src/pointer.rs
@@ -37,7 +37,7 @@ impl Pointer {
     }
 
     pub(crate) fn const_addr<'a, 'tcx>(
-        fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'a, 'tcx, impl Module>,
         addr: i64,
     ) -> Self {
         let addr = fx.bcx.ins().iconst(fx.pointer_type, addr);
@@ -59,7 +59,7 @@ impl Pointer {
         (self.base, self.offset)
     }
 
-    pub(crate) fn get_addr<'a, 'tcx>(self, fx: &mut FunctionCx<'a, 'tcx, impl Backend>) -> Value {
+    pub(crate) fn get_addr<'a, 'tcx>(self, fx: &mut FunctionCx<'a, 'tcx, impl Module>) -> Value {
         match self.base {
             PointerBase::Addr(base_addr) => {
                 let offset: i64 = self.offset.into();
@@ -83,7 +83,7 @@ impl Pointer {
 
     pub(crate) fn offset<'a, 'tcx>(
         self,
-        fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'a, 'tcx, impl Module>,
         extra_offset: Offset32,
     ) -> Self {
         self.offset_i64(fx, extra_offset.into())
@@ -91,7 +91,7 @@ impl Pointer {
 
     pub(crate) fn offset_i64<'a, 'tcx>(
         self,
-        fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'a, 'tcx, impl Module>,
         extra_offset: i64,
     ) -> Self {
         if let Some(new_offset) = self.offset.try_add_i64(extra_offset) {
@@ -128,7 +128,7 @@ impl Pointer {
 
     pub(crate) fn offset_value<'a, 'tcx>(
         self,
-        fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'a, 'tcx, impl Module>,
         extra_offset: Value,
     ) -> Self {
         match self.base {
@@ -161,7 +161,7 @@ impl Pointer {
 
     pub(crate) fn load<'a, 'tcx>(
         self,
-        fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'a, 'tcx, impl Module>,
         ty: Type,
         flags: MemFlags,
     ) -> Value {
@@ -182,7 +182,7 @@ impl Pointer {
 
     pub(crate) fn store<'a, 'tcx>(
         self,
-        fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'a, 'tcx, impl Module>,
         value: Value,
         flags: MemFlags,
     ) {
diff --git a/src/pretty_clif.rs b/src/pretty_clif.rs
index 5c4d951bc50..e99bec45a5e 100644
--- a/src/pretty_clif.rs
+++ b/src/pretty_clif.rs
@@ -186,7 +186,7 @@ impl FuncWriter for &'_ CommentWriter {
 }
 
 #[cfg(debug_assertions)]
-impl<B: Backend + 'static> FunctionCx<'_, '_, B> {
+impl<M: Module> FunctionCx<'_, '_, M> {
     pub(crate) fn add_global_comment<S: Into<String>>(&mut self, comment: S) {
         self.clif_comments.add_global_comment(comment);
     }
@@ -264,7 +264,7 @@ pub(crate) fn write_clif_file<'tcx>(
     }
 }
 
-impl<B: Backend + 'static> fmt::Debug for FunctionCx<'_, '_, B> {
+impl<M: Module> fmt::Debug for FunctionCx<'_, '_, M> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         writeln!(f, "{:?}", self.instance.substs)?;
         writeln!(f, "{:?}", self.local_map)?;
diff --git a/src/trap.rs b/src/trap.rs
index f3ce0ee4beb..007b6465605 100644
--- a/src/trap.rs
+++ b/src/trap.rs
@@ -2,7 +2,7 @@
 
 use crate::prelude::*;
 
-fn codegen_print(fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>, msg: &str) {
+fn codegen_print(fx: &mut FunctionCx<'_, '_, impl Module>, msg: &str) {
     let puts = fx
         .cx
         .module
@@ -30,7 +30,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>, ms
 
 /// Trap code: user1
 pub(crate) fn trap_abort(
-    fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>,
+    fx: &mut FunctionCx<'_, '_, impl Module>,
     msg: impl AsRef<str>,
 ) {
     codegen_print(fx, msg.as_ref());
@@ -42,7 +42,7 @@ pub(crate) fn trap_abort(
 ///
 /// Trap code: user65535
 pub(crate) fn trap_unreachable(
-    fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>,
+    fx: &mut FunctionCx<'_, '_, impl Module>,
     msg: impl AsRef<str>,
 ) {
     codegen_print(fx, msg.as_ref());
@@ -53,7 +53,7 @@ pub(crate) fn trap_unreachable(
 ///
 /// Trap code: user65535
 pub(crate) fn trap_unreachable_ret_value<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl cranelift_module::Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     dest_layout: TyAndLayout<'tcx>,
     msg: impl AsRef<str>,
 ) -> CValue<'tcx> {
@@ -69,7 +69,7 @@ pub(crate) fn trap_unreachable_ret_value<'tcx>(
 ///
 /// Trap code: user65535
 pub(crate) fn trap_unimplemented(
-    fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>,
+    fx: &mut FunctionCx<'_, '_, impl Module>,
     msg: impl AsRef<str>,
 ) {
     codegen_print(fx, msg.as_ref());
@@ -81,7 +81,7 @@ pub(crate) fn trap_unimplemented(
 ///
 /// Trap code: user65535
 pub(crate) fn trap_unimplemented_ret_value<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl cranelift_module::Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     dest_layout: TyAndLayout<'tcx>,
     msg: impl AsRef<str>,
 ) -> CValue<'tcx> {
diff --git a/src/unsize.rs b/src/unsize.rs
index 441d2b5edd8..c77ff5d56ba 100644
--- a/src/unsize.rs
+++ b/src/unsize.rs
@@ -13,7 +13,7 @@ use crate::prelude::*;
 /// in an upcast, where the new vtable for an object will be derived
 /// from the old one.
 pub(crate) fn unsized_info<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     source: Ty<'tcx>,
     target: Ty<'tcx>,
     old_info: Option<Value>,
@@ -45,7 +45,7 @@ pub(crate) fn unsized_info<'tcx>(
 
 /// Coerce `src` to `dst_ty`. `src_ty` must be a thin pointer.
 fn unsize_thin_ptr<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     src: Value,
     src_layout: TyAndLayout<'tcx>,
     dst_layout: TyAndLayout<'tcx>,
@@ -89,7 +89,7 @@ fn unsize_thin_ptr<'tcx>(
 /// Coerce `src`, which is a reference to a value of type `src_ty`,
 /// to a value of type `dst_ty` and store the result in `dst`
 pub(crate) fn coerce_unsized_into<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     src: CValue<'tcx>,
     dst: CPlace<'tcx>,
 ) {
@@ -142,7 +142,7 @@ pub(crate) fn coerce_unsized_into<'tcx>(
 // Adapted from https://github.com/rust-lang/rust/blob/2a663555ddf36f6b041445894a8c175cd1bc718c/src/librustc_codegen_ssa/glue.rs
 
 pub(crate) fn size_and_align_of_dst<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     layout: TyAndLayout<'tcx>,
     info: Value,
 ) -> (Value, Value) {
diff --git a/src/value_and_place.rs b/src/value_and_place.rs
index 5e663425117..5d513cb3ea0 100644
--- a/src/value_and_place.rs
+++ b/src/value_and_place.rs
@@ -6,7 +6,7 @@ use cranelift_codegen::entity::EntityRef;
 use cranelift_codegen::ir::immediates::Offset32;
 
 fn codegen_field<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     base: Pointer,
     extra: Option<Value>,
     layout: TyAndLayout<'tcx>,
@@ -108,7 +108,7 @@ impl<'tcx> CValue<'tcx> {
     // FIXME remove
     pub(crate) fn force_stack(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     ) -> (Pointer, Option<Value>) {
         let layout = self.1;
         match self.0 {
@@ -129,7 +129,7 @@ impl<'tcx> CValue<'tcx> {
     }
 
     /// Load a value with layout.abi of scalar
-    pub(crate) fn load_scalar(self, fx: &mut FunctionCx<'_, 'tcx, impl Backend>) -> Value {
+    pub(crate) fn load_scalar(self, fx: &mut FunctionCx<'_, 'tcx, impl Module>) -> Value {
         let layout = self.1;
         match self.0 {
             CValueInner::ByRef(ptr, None) => {
@@ -155,7 +155,7 @@ impl<'tcx> CValue<'tcx> {
     /// Load a value pair with layout.abi of scalar pair
     pub(crate) fn load_scalar_pair(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     ) -> (Value, Value) {
         let layout = self.1;
         match self.0 {
@@ -183,7 +183,7 @@ impl<'tcx> CValue<'tcx> {
 
     pub(crate) fn value_field(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         field: mir::Field,
     ) -> CValue<'tcx> {
         let layout = self.1;
@@ -221,7 +221,7 @@ impl<'tcx> CValue<'tcx> {
 
     pub(crate) fn unsize_value(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         dest: CPlace<'tcx>,
     ) {
         crate::unsize::coerce_unsized_into(fx, self, dest);
@@ -229,7 +229,7 @@ impl<'tcx> CValue<'tcx> {
 
     /// If `ty` is signed, `const_val` must already be sign extended.
     pub(crate) fn const_val(
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         layout: TyAndLayout<'tcx>,
         const_val: u128,
     ) -> CValue<'tcx> {
@@ -325,7 +325,7 @@ impl<'tcx> CPlace<'tcx> {
     }
 
     pub(crate) fn new_stack_slot(
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         layout: TyAndLayout<'tcx>,
     ) -> CPlace<'tcx> {
         assert!(!layout.is_unsized());
@@ -345,7 +345,7 @@ impl<'tcx> CPlace<'tcx> {
     }
 
     pub(crate) fn new_var(
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         local: Local,
         layout: TyAndLayout<'tcx>,
     ) -> CPlace<'tcx> {
@@ -359,7 +359,7 @@ impl<'tcx> CPlace<'tcx> {
     }
 
     pub(crate) fn new_var_pair(
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         local: Local,
         layout: TyAndLayout<'tcx>,
     ) -> CPlace<'tcx> {
@@ -395,7 +395,7 @@ impl<'tcx> CPlace<'tcx> {
         }
     }
 
-    pub(crate) fn to_cvalue(self, fx: &mut FunctionCx<'_, 'tcx, impl Backend>) -> CValue<'tcx> {
+    pub(crate) fn to_cvalue(self, fx: &mut FunctionCx<'_, 'tcx, impl Module>) -> CValue<'tcx> {
         let layout = self.layout();
         match self.inner {
             CPlaceInner::Var(_local, var) => {
@@ -448,11 +448,11 @@ impl<'tcx> CPlace<'tcx> {
 
     pub(crate) fn write_cvalue(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         from: CValue<'tcx>,
     ) {
         fn assert_assignable<'tcx>(
-            fx: &FunctionCx<'_, 'tcx, impl Backend>,
+            fx: &FunctionCx<'_, 'tcx, impl Module>,
             from_ty: Ty<'tcx>,
             to_ty: Ty<'tcx>,
         ) {
@@ -514,7 +514,7 @@ impl<'tcx> CPlace<'tcx> {
 
     pub(crate) fn write_cvalue_transmute(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         from: CValue<'tcx>,
     ) {
         self.write_cvalue_maybe_transmute(fx, from, "write_cvalue_transmute");
@@ -522,12 +522,12 @@ impl<'tcx> CPlace<'tcx> {
 
     fn write_cvalue_maybe_transmute(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         from: CValue<'tcx>,
         #[cfg_attr(not(debug_assertions), allow(unused_variables))] method: &'static str,
     ) {
         fn transmute_value<'tcx>(
-            fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+            fx: &mut FunctionCx<'_, 'tcx, impl Module>,
             var: Variable,
             data: Value,
             dst_ty: Type,
@@ -667,7 +667,7 @@ impl<'tcx> CPlace<'tcx> {
 
     pub(crate) fn place_field(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         field: mir::Field,
     ) -> CPlace<'tcx> {
         let layout = self.layout();
@@ -715,7 +715,7 @@ impl<'tcx> CPlace<'tcx> {
 
     pub(crate) fn place_index(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         index: Value,
     ) -> CPlace<'tcx> {
         let (elem_layout, ptr) = match self.layout().ty.kind() {
@@ -732,7 +732,7 @@ impl<'tcx> CPlace<'tcx> {
         CPlace::for_ptr(ptr.offset_value(fx, offset), elem_layout)
     }
 
-    pub(crate) fn place_deref(self, fx: &mut FunctionCx<'_, 'tcx, impl Backend>) -> CPlace<'tcx> {
+    pub(crate) fn place_deref(self, fx: &mut FunctionCx<'_, 'tcx, impl Module>) -> CPlace<'tcx> {
         let inner_layout = fx.layout_of(self.layout().ty.builtin_deref(true).unwrap().ty);
         if has_ptr_meta(fx.tcx, inner_layout.ty) {
             let (addr, extra) = self.to_cvalue(fx).load_scalar_pair(fx);
@@ -747,7 +747,7 @@ impl<'tcx> CPlace<'tcx> {
 
     pub(crate) fn place_ref(
         self,
-        fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &mut FunctionCx<'_, 'tcx, impl Module>,
         layout: TyAndLayout<'tcx>,
     ) -> CValue<'tcx> {
         if has_ptr_meta(fx.tcx, self.layout().ty) {
@@ -764,7 +764,7 @@ impl<'tcx> CPlace<'tcx> {
 
     pub(crate) fn downcast_variant(
         self,
-        fx: &FunctionCx<'_, 'tcx, impl Backend>,
+        fx: &FunctionCx<'_, 'tcx, impl Module>,
         variant: VariantIdx,
     ) -> Self {
         assert!(!self.layout().is_unsized());
diff --git a/src/vtable.rs b/src/vtable.rs
index d6bb9c912b5..bb3cf8b3f3a 100644
--- a/src/vtable.rs
+++ b/src/vtable.rs
@@ -15,7 +15,7 @@ fn vtable_memflags() -> MemFlags {
     flags
 }
 
-pub(crate) fn drop_fn_of_obj(fx: &mut FunctionCx<'_, '_, impl Backend>, vtable: Value) -> Value {
+pub(crate) fn drop_fn_of_obj(fx: &mut FunctionCx<'_, '_, impl Module>, vtable: Value) -> Value {
     let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
     fx.bcx.ins().load(
         pointer_ty(fx.tcx),
@@ -25,7 +25,7 @@ pub(crate) fn drop_fn_of_obj(fx: &mut FunctionCx<'_, '_, impl Backend>, vtable:
     )
 }
 
-pub(crate) fn size_of_obj(fx: &mut FunctionCx<'_, '_, impl Backend>, vtable: Value) -> Value {
+pub(crate) fn size_of_obj(fx: &mut FunctionCx<'_, '_, impl Module>, vtable: Value) -> Value {
     let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
     fx.bcx.ins().load(
         pointer_ty(fx.tcx),
@@ -35,7 +35,7 @@ pub(crate) fn size_of_obj(fx: &mut FunctionCx<'_, '_, impl Backend>, vtable: Val
     )
 }
 
-pub(crate) fn min_align_of_obj(fx: &mut FunctionCx<'_, '_, impl Backend>, vtable: Value) -> Value {
+pub(crate) fn min_align_of_obj(fx: &mut FunctionCx<'_, '_, impl Module>, vtable: Value) -> Value {
     let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
     fx.bcx.ins().load(
         pointer_ty(fx.tcx),
@@ -46,7 +46,7 @@ pub(crate) fn min_align_of_obj(fx: &mut FunctionCx<'_, '_, impl Backend>, vtable
 }
 
 pub(crate) fn get_ptr_and_method_ref<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     arg: CValue<'tcx>,
     idx: usize,
 ) -> (Value, Value) {
@@ -68,7 +68,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
 }
 
 pub(crate) fn get_vtable<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     layout: TyAndLayout<'tcx>,
     trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
 ) -> Value {
@@ -85,7 +85,7 @@ pub(crate) fn get_vtable<'tcx>(
 }
 
 fn build_vtable<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
+    fx: &mut FunctionCx<'_, 'tcx, impl Module>,
     layout: TyAndLayout<'tcx>,
     trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
 ) -> DataId {
@@ -137,6 +137,16 @@ fn build_vtable<'tcx>(
         }
     }
 
+    data_ctx.set_align(
+        fx.tcx
+            .data_layout
+            .pointer_align
+            .pref
+            .bytes()
+            .try_into()
+            .unwrap(),
+    );
+
     let data_id = fx
         .cx
         .module
@@ -153,15 +163,6 @@ fn build_vtable<'tcx>(
             Linkage::Local,
             false,
             false,
-            Some(
-                fx.tcx
-                    .data_layout
-                    .pointer_align
-                    .pref
-                    .bytes()
-                    .try_into()
-                    .unwrap(),
-            ),
         )
         .unwrap();