diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-02-24 11:14:21 +0000 | 
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-02-24 15:11:29 +0000 | 
| commit | 396baa750e51a0e40fb0b803bfa6399a35e604a2 (patch) | |
| tree | b26c35943e4ccc9afaa3cefd36f4f4a39a74e71e /compiler/rustc_codegen_llvm/src/lib.rs | |
| parent | 840e31b29f93a5e0569d05c8879468877a9991d4 (diff) | |
| download | rust-396baa750e51a0e40fb0b803bfa6399a35e604a2.tar.gz rust-396baa750e51a0e40fb0b803bfa6399a35e604a2.zip | |
Make allocator shim creation mostly use safe code
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/lib.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/lib.rs | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index e9e1b644f18..a15ec6000bc 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -29,6 +29,7 @@ use std::mem::ManuallyDrop; use back::owned_target_machine::OwnedTargetMachine; use back::write::{create_informational_target_machine, create_target_machine}; +use context::SimpleCx; use errors::{AutoDiffWithoutLTO, ParseTargetMachineConfig}; pub(crate) use llvm_util::target_features_cfg; use rustc_ast::expand::allocator::AllocatorKind; @@ -116,9 +117,11 @@ impl ExtraBackendMethods for LlvmCodegenBackend { kind: AllocatorKind, alloc_error_handler_kind: AllocatorKind, ) -> ModuleLlvm { - let mut module_llvm = ModuleLlvm::new_metadata(tcx, module_name); + let module_llvm = ModuleLlvm::new_metadata(tcx, module_name); + let cx = + SimpleCx::new(module_llvm.llmod(), &module_llvm.llcx, tcx.data_layout.pointer_size); unsafe { - allocator::codegen(tcx, &mut module_llvm, module_name, kind, alloc_error_handler_kind); + allocator::codegen(tcx, cx, module_name, kind, alloc_error_handler_kind); } module_llvm } | 
