Preserve split DWARF files when building archives.

The optimization that removes artifacts when building libraries is correct
from the compiler's perspective but not from a debugger's perspective.
Unpacked split debuginfo is referred to by filename and debuggers need
the artifact that contains debuginfo to continue to exist at that path.

Ironically the test expects the correct behavior but it was not running.
This commit is contained in:
Kyle Huey 2023-01-15 09:40:46 -08:00
parent 754f6d4a8c
commit 2b99b9fd25
3 changed files with 2 additions and 20 deletions

View file

@ -1300,12 +1300,6 @@ fn preserve_objects_for_their_debuginfo(sess: &Session) -> (bool, bool) {
return (false, false);
}
// If we're only producing artifacts that are archives, no need to preserve
// the objects as they're losslessly contained inside the archives.
if sess.crate_types().iter().all(|&x| x.is_archive()) {
return (false, false);
}
match (sess.split_debuginfo(), sess.opts.unstable_opts.split_dwarf_kind) {
// If there is no split debuginfo then do not preserve objects.
(SplitDebuginfo::Off, _) => (false, false),