diff options
| author | bors <bors@rust-lang.org> | 2025-01-14 00:23:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-14 00:23:49 +0000 |
| commit | 1ab85fbd7474e8ce84d5283548f21472860de3e2 (patch) | |
| tree | 0ee8555f38a88a539e16a879eb703b95b5b31bfb /compiler/rustc_codegen_llvm/src | |
| parent | 2ae9916816a448fcaab3b2da461de754eda0055a (diff) | |
| parent | 40f5861de90099617a2a6c38cda5cc037607b413 (diff) | |
| download | rust-1ab85fbd7474e8ce84d5283548f21472860de3e2.tar.gz rust-1ab85fbd7474e8ce84d5283548f21472860de3e2.zip | |
Auto merge of #135438 - matthiaskrgr:rollup-rt2zrbz, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #133752 (replace copypasted ModuleLlvm::parse) - #135245 (rustc_feature: Avoid unsafe `std::env::set_var()` in `UnstableFeatures` tests) - #135405 (path: Move is_absolute check to sys::path) - #135426 (Assert that `Instance::try_resolve` is only used on body-like things) r? `@ghost` `@rustbot` modify labels: rollup try-job: x86_64-mingw-1
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/lto.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 08b774f8d6e..78c759bbe8c 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -1,7 +1,6 @@ use std::collections::BTreeMap; use std::ffi::{CStr, CString}; use std::fs::File; -use std::mem::ManuallyDrop; use std::path::Path; use std::sync::Arc; use std::{io, iter, slice}; @@ -9,7 +8,7 @@ use std::{io, iter, slice}; use object::read::archive::ArchiveFile; use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared}; use rustc_codegen_ssa::back::symbol_export; -use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, TargetMachineFactoryConfig}; +use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput}; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file}; use rustc_data_structures::fx::FxHashMap; @@ -706,18 +705,15 @@ pub(crate) unsafe fn optimize_thin_module( let dcx = dcx.handle(); let module_name = &thin_module.shared.module_names[thin_module.idx]; - let tm_factory_config = TargetMachineFactoryConfig::new(cgcx, module_name.to_str().unwrap()); - let tm = (cgcx.tm_factory)(tm_factory_config).map_err(|e| write::llvm_err(dcx, e))?; // Right now the implementation we've got only works over serialized // modules, so we create a fresh new LLVM context and parse the module // into that context. One day, however, we may do this for upstream // crates but for locally codegened modules we may be able to reuse // that LLVM Context and Module. - let llcx = unsafe { llvm::LLVMRustContextCreate(cgcx.fewer_names) }; - let llmod_raw = parse_module(llcx, module_name, thin_module.data(), dcx)? as *const _; + let module_llvm = ModuleLlvm::parse(cgcx, module_name, thin_module.data(), dcx)?; let mut module = ModuleCodegen { - module_llvm: ModuleLlvm { llmod_raw, llcx, tm: ManuallyDrop::new(tm) }, + module_llvm, name: thin_module.name().to_string(), kind: ModuleKind::Regular, }; |
