Inconsistent behavior across platform of split-debuginfo #114215
Closed
Description
opened on Jul 29, 2023
Setting up a release profile with stripped binaries and split debuginfo is made very complicated due to subtle differences in how debug
, strip
and split-debuginfo
interact with eachother across platforms. In particular, in the following setup:
[profile.release]
split-debuginfo = "packed"
strip = "symbols"
debug = "limited"
Then when targetting linux/macos, a .dwp
/.dSYM
debug information file will be generated, while when targeting windows, no debug information file can be found. In particular, no .pdb
file is created.
This seems to stem from how the flags propagate to linker invocation:
- On windows, the
debuginfo
function of rustc_codegen_ssa only takesstrip
into account when choosing how to generate the debug information. If it's set to any value other than None, it will not generate any debuginfo whatsoever, regardless of the value ofsplit-debuginfo
. - On macos/linux, it's
rustc_codegen_ssa::back::link_natively
that's responsible both for splitting debuginfo and stripping. A.dSYM
/.dwp
file will be created only ifdebug
is set to a value other than 0, andsplit-debuginfo
is set to packed. Stripping is, crucially, not a part of the equation.
I believe the behavior with the windows should be adjusted to match what is done on macos/linux. In particular, if split-debuginfo
is set to packed
and strip is set to symbols
, then a pdb
file should be generated.
Meta
rustc --version --verbose
:
rustc 1.71.0 (8ede3aae2 2023-07-12)
binary: rustc
commit-hash: 8ede3aae28fe6e4d52b38157d7bfe0d3bceef225
commit-date: 2023-07-12
host: aarch64-apple-darwin
release: 1.71.0
LLVM version: 16.0.5
Activity