Skip to content

DWARF info for static vars in lib crates has stopped being produced reliably in LTO builds #90357

Closed

Description

As of the 2021-09-23 nightly, rustc has stopped producing debug output for variables in a specific combination of circumstances:

  • The variable is static
  • It is defined in a lib crate.
  • The lib crate is included in a bin crate.
  • The bin crate is built with lto = true.

We noticed this after bumping past 09-23 to the 2021-10-27 nightly, when our debugger broke. The static is still being included in the ELF output (both allocated space, and represented correctly in the symtab), but is missing from DWARF. Bisecting indicates 2021-09-23 as the culprit (09-22 works).

Here is a repro case that I've reduced that works on linux x86-64, at least, and probably other DWARF platforms.

https://github.com/cbiffle/rustc-dwarf-regression-repro

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

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

Metadata

Assignees

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-LTOArea: Link-time optimization (LTO)A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)A-reproducibilityArea: Reproducible / deterministic buildsC-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions