Skip to content

Inconsistent behavior across platform of split-debuginfo #114215

Closed
@roblabla

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.O-linuxOperating system: LinuxO-macosOperating system: macOSO-windowsOperating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions