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 takes strip 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 of split-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 if debug is set to a value other than 0, and split-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
Setting up a release profile with stripped binaries and split debuginfo is made very complicated due to subtle differences in how
debug,stripandsplit-debuginfointeract with eachother across platforms. In particular, in the following setup:Then when targetting linux/macos, a
.dwp/.dSYMdebug information file will be generated, while when targeting windows, no debug information file can be found. In particular, no.pdbfile is created.This seems to stem from how the flags propagate to linker invocation:
debuginfofunction of rustc_codegen_ssa only takesstripinto 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.rustc_codegen_ssa::back::link_nativelythat's responsible both for splitting debuginfo and stripping. A.dSYM/.dwpfile will be created only ifdebugis set to a value other than 0, andsplit-debuginfois 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-debuginfois set topackedand strip is set tosymbols, then apdbfile should be generated.Meta
rustc --version --verbose: