Skip to content

Commit e21502c

Browse files
committed
Fill out links_from_incr_cache in cg_clif
1 parent cae7c76 commit e21502c

File tree

1 file changed

+10
-8
lines changed
  • compiler/rustc_codegen_cranelift/src/driver

1 file changed

+10
-8
lines changed

compiler/rustc_codegen_cranelift/src/driver/aot.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -464,22 +464,23 @@ fn reuse_workproduct_for_cgu(
464464
err
465465
));
466466
}
467+
467468
let obj_out_global_asm =
468469
crate::global_asm::add_file_stem_postfix(obj_out_regular.clone(), ".asm");
469-
let has_global_asm = if let Some(asm_o) = work_product.saved_files.get("asm.o") {
470+
let source_file_global_asm = if let Some(asm_o) = work_product.saved_files.get("asm.o") {
470471
let source_file_global_asm = rustc_incremental::in_incr_comp_dir_sess(&tcx.sess, asm_o);
471472
if let Err(err) = rustc_fs_util::link_or_copy(&source_file_global_asm, &obj_out_global_asm)
472473
{
473474
return Err(format!(
474475
"unable to copy {} to {}: {}",
475-
source_file_regular.display(),
476-
obj_out_regular.display(),
476+
source_file_global_asm.display(),
477+
obj_out_global_asm.display(),
477478
err
478479
));
479480
}
480-
true
481+
Some(source_file_global_asm)
481482
} else {
482-
false
483+
None
483484
};
484485

485486
Ok(ModuleCodegenResult {
@@ -491,17 +492,17 @@ fn reuse_workproduct_for_cgu(
491492
bytecode: None,
492493
assembly: None,
493494
llvm_ir: None,
494-
links_from_incr_cache: Vec::new(),
495+
links_from_incr_cache: vec![source_file_regular],
495496
},
496-
module_global_asm: has_global_asm.then(|| CompiledModule {
497+
module_global_asm: source_file_global_asm.map(|source_file| CompiledModule {
497498
name: cgu.name().to_string(),
498499
kind: ModuleKind::Regular,
499500
object: Some(obj_out_global_asm),
500501
dwarf_object: None,
501502
bytecode: None,
502503
assembly: None,
503504
llvm_ir: None,
504-
links_from_incr_cache: Vec::new(),
505+
links_from_incr_cache: vec![source_file],
505506
}),
506507
existing_work_product: Some((cgu.work_product_id(), work_product)),
507508
})
@@ -752,6 +753,7 @@ pub(crate) fn run_aot(
752753

753754
let metadata_module =
754755
if need_metadata_module { Some(emit_metadata_module(tcx, &metadata)) } else { None };
756+
755757
Box::new(OngoingCodegen {
756758
modules,
757759
allocator_module,

0 commit comments

Comments
 (0)