Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve split DWARF files when building archives. #106904

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
12 changes: 0 additions & 12 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,18 +846,6 @@ pub enum CrateType {
ProcMacro,
}

impl CrateType {
/// When generated, is this crate type an archive?
pub fn is_archive(&self) -> bool {
match *self {
CrateType::Rlib | CrateType::Staticlib => true,
CrateType::Executable | CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro => {
false
}
}
}
}

#[derive(Clone, Hash, Debug, PartialEq, Eq)]
pub enum Passes {
Some(Vec<String>),
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make-fulldeps/split-debuginfo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ unpacked-remapped-single:
$(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
-Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g
objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
ls $(TMPDIR)/*.o
rm $(TMPDIR)/*.o
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
rm $(TMPDIR)/$(call BIN,foo)

unpacked-crosscrate: packed-crosscrate-split packed-crosscrate-single
unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single

# - Debuginfo in `.dwo` files
# - (bar) `.rlib` file created, contains `.dwo`
Expand Down