Skip to content

Commit 8774487

Browse files
committed
Ensure fat LTO doesn't merge everything into the allocator module
1 parent 8878a67 commit 8774487

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/driver/aot.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ use cranelift_object::{ObjectBuilder, ObjectModule};
1212
use rustc_codegen_ssa::assert_module_sources::CguReuse;
1313
use rustc_codegen_ssa::back::link::ensure_removed;
1414
use rustc_codegen_ssa::base::determine_cgu_reuse;
15-
use rustc_codegen_ssa::{CodegenResults, CompiledModule, CrateInfo, errors as ssa_errors};
15+
use rustc_codegen_ssa::{
16+
CodegenResults, CompiledModule, CrateInfo, ModuleKind, errors as ssa_errors,
17+
};
1618
use rustc_data_structures::profiling::SelfProfilerRef;
1719
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1820
use rustc_data_structures::sync::{IntoDynSyncSend, par_map};
@@ -361,6 +363,7 @@ fn emit_cgu(
361363
invocation_temp,
362364
prof,
363365
product.object,
366+
ModuleKind::Regular,
364367
name.clone(),
365368
producer,
366369
)?;
@@ -369,6 +372,7 @@ fn emit_cgu(
369372
module_regular,
370373
module_global_asm: global_asm_object_file.map(|global_asm_object_file| CompiledModule {
371374
name: format!("{name}.asm"),
375+
kind: ModuleKind::Regular,
372376
object: Some(global_asm_object_file),
373377
dwarf_object: None,
374378
bytecode: None,
@@ -385,6 +389,7 @@ fn emit_module(
385389
invocation_temp: Option<&str>,
386390
prof: &SelfProfilerRef,
387391
mut object: cranelift_object::object::write::Object<'_>,
392+
kind: ModuleKind,
388393
name: String,
389394
producer_str: &str,
390395
) -> Result<CompiledModule, String> {
@@ -425,6 +430,7 @@ fn emit_module(
425430

426431
Ok(CompiledModule {
427432
name,
433+
kind,
428434
object: Some(tmp_file),
429435
dwarf_object: None,
430436
bytecode: None,
@@ -479,6 +485,7 @@ fn reuse_workproduct_for_cgu(
479485
Ok(ModuleCodegenResult {
480486
module_regular: CompiledModule {
481487
name: cgu.name().to_string(),
488+
kind: ModuleKind::Regular,
482489
object: Some(obj_out_regular),
483490
dwarf_object: None,
484491
bytecode: None,
@@ -488,6 +495,7 @@ fn reuse_workproduct_for_cgu(
488495
},
489496
module_global_asm: source_file_global_asm.map(|source_file| CompiledModule {
490497
name: cgu.name().to_string(),
498+
kind: ModuleKind::Regular,
491499
object: Some(obj_out_global_asm),
492500
dwarf_object: None,
493501
bytecode: None,
@@ -643,6 +651,7 @@ fn emit_allocator_module(tcx: TyCtxt<'_>) -> Option<CompiledModule> {
643651
tcx.sess.invocation_temp.as_deref(),
644652
&tcx.sess.prof,
645653
product.object,
654+
ModuleKind::Allocator,
646655
"allocator_shim".to_owned(),
647656
&crate::debuginfo::producer(tcx.sess),
648657
) {

0 commit comments

Comments
 (0)