ssa: remove dwo of metadata and allocator module
Compiling with `-Csplit-debuginfo=packed` was leaving behind `.dwo` files because either the metadata or allocator module contained a DWARF object which was not being removed by the `maybe_remove_temps_from_module` closure.
This commit is contained in:
parent
8371a036ea
commit
fc641f21c2
1 changed files with 18 additions and 14 deletions
|
@ -151,12 +151,24 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let remove_temps_from_module = |module: &CompiledModule| {
|
let maybe_remove_temps_from_module =
|
||||||
|
|preserve_objects: bool, preserve_dwarf_objects: bool, module: &CompiledModule| {
|
||||||
|
if !preserve_objects {
|
||||||
if let Some(ref obj) = module.object {
|
if let Some(ref obj) = module.object {
|
||||||
ensure_removed(sess.diagnostic(), obj);
|
ensure_removed(sess.diagnostic(), obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !preserve_dwarf_objects {
|
||||||
|
if let Some(ref dwo_obj) = module.dwarf_object {
|
||||||
|
ensure_removed(sess.diagnostic(), dwo_obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let remove_temps_from_module =
|
||||||
|
|module: &CompiledModule| maybe_remove_temps_from_module(false, false, module);
|
||||||
|
|
||||||
// Otherwise, always remove the metadata and allocator module temporaries.
|
// Otherwise, always remove the metadata and allocator module temporaries.
|
||||||
if let Some(ref metadata_module) = codegen_results.metadata_module {
|
if let Some(ref metadata_module) = codegen_results.metadata_module {
|
||||||
remove_temps_from_module(metadata_module);
|
remove_temps_from_module(metadata_module);
|
||||||
|
@ -177,15 +189,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
|
||||||
debug!(?preserve_objects, ?preserve_dwarf_objects);
|
debug!(?preserve_objects, ?preserve_dwarf_objects);
|
||||||
|
|
||||||
for module in &codegen_results.modules {
|
for module in &codegen_results.modules {
|
||||||
if !preserve_objects {
|
maybe_remove_temps_from_module(preserve_objects, preserve_dwarf_objects, module);
|
||||||
remove_temps_from_module(module);
|
|
||||||
}
|
|
||||||
|
|
||||||
if !preserve_dwarf_objects {
|
|
||||||
if let Some(ref obj) = module.dwarf_object {
|
|
||||||
ensure_removed(sess.diagnostic(), obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue