Skip to content

Register .dwp files as debuginfo artifacts so they get uplifted #11384

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

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 10 additions & 0 deletions src/cargo/core/compiler/build_context/target_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,16 @@ impl TargetInfo {
// preserved.
should_replace_hyphens: true,
})
} else {
ret.push(FileType {
suffix: ".dwp".to_string(),
prefix: prefix.clone(),
flavor: FileFlavor::DebugInfo,
crate_type: Some(crate_type),
// Currently no known reason to prefer one naming scheme
Copy link
Member

@weihanglo weihanglo Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could have a comment with a link to https://dwarfstd.org/doc/DWARF5.pdf or rustc implementation as a reference, like what .pdb and .dSYM do.

// over the other, but the macos approach seems friendlier.
should_replace_hyphens: false,
})
}
}

Expand Down
9 changes: 7 additions & 2 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4788,9 +4788,14 @@ fn cdylib_final_outputs() {
}

#[cargo_test]
// NOTE: Windows MSVC and wasm32-unknown-emscripten do not use metadata. Skip them.
// NOTE: Windows MSVC and wasm32-unknown-emscripten do not use metadata.
// See <https://github.com/rust-lang/cargo/issues/9325#issuecomment-1030662699>
#[cfg(not(all(target_os = "windows", target_env = "msvc")))]
//
// We skip both msvc windows and gnu windows (mingw) because their naming schemes for
// debuginfo files results in conflicts in this case. msvc makes two `foo.pdb` files
// while mingw makes two `foo.dwp` files. These files clobber eachother,
// corrupting the build output.
#[cfg(not(target_os = "windows"))]
fn no_dep_info_collision_when_cdylib_and_bin_coexist() {
let p = project()
.file(
Expand Down