mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
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
@ -151,12 +151,24 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
|
||||
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 {
|
||||
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.
|
||||
if let Some(ref metadata_module) = codegen_results.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);
|
||||
|
||||
for module in &codegen_results.modules {
|
||||
if !preserve_objects {
|
||||
remove_temps_from_module(module);
|
||||
}
|
||||
|
||||
if !preserve_dwarf_objects {
|
||||
if let Some(ref obj) = module.dwarf_object {
|
||||
ensure_removed(sess.diagnostic(), obj);
|
||||
}
|
||||
}
|
||||
maybe_remove_temps_from_module(preserve_objects, preserve_dwarf_objects, module);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user