-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Stabilize -Zdebuginfo-compression as -Cdebuginfo-compression
#150625
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
base: main
Are you sure you want to change the base?
Stabilize -Zdebuginfo-compression as -Cdebuginfo-compression
#150625
Conversation
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
|
A few questions: Do we expect both zstd and zlib compression to be available in most distribution LLVM toolchains? Should we consider making that more of a requirement (e.g., needs a flag to opt out of at build time rather than silently not supporting them)? Relatedly, are we confident we ourselves build with support on across all tier 1 and 2 targets? It looks like we require explicit opt-in today for at least zstd, see bootstrap code. I see in It also looks like =none for |
Unfortunately while backtrace-rs has support for zstd compressed debug info it was never turned on in std due to binary size concerns. See #130417 |
|
What happens when LLVM is compiled without zlib or zstd support? Do we error, silently not compress or not compress with a warning? |
|
One other thought: in principle, compression implies additional parameters (at least a level). We should consider how/if we would want to expose that via some standard flag. It looks like |
|
@rustbot reroll |
I propose stabilizing
-Zdebuginfo-compressionas-Cdebuginfo-compression. This PR adds a new-Cdebuginfo-compressionflag, leaving the unstable-Zflag as-is to ease the transition period. The-Zflag will be removed in the future.-Zdebuginfo-compressionstabilization reportWhat is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized?
No RFC/MCP, this flag was added in #115358 and was not deemed large enough to require additional process.
The tracking issue for this feature is #120953.
What behavior are we committing to that has been controversial? Summarize the major arguments pro/con.
None that has been extensively debated but there is one obvious question:
Currently, passing
-{C,Z} debuginfo-compressionon targets like*-windows-msvcdoes not do anything. I believe it generally makes sense to alert the user when codegen flags are being ignored and I've opened an MCP Lint unsupported, target-specifc codegen flags compiler-team#957 that proposes handling this in a consistent way rather than on a ad-hoc, per-flag basis.Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those.
No extensions per se, although not all debuginfo formats support compression (such as PDB/CodeView). If those formats incorporate compression support in the future, this feature can be extended when that support materializes. The implementation does not blindly forward the flag to the linker so we'll need to intentionally modify the compiler to enable that support.
Summarize the major parts of the implementation and provide links into the code (or to PRs)
-{C,Z} debuginfo-compression(preferring the stabilized-Cversion)rust/compiler/rustc_session/src/session.rs
Lines 717 to 723 in c419816
zliborzstdcompression (our LLVM builds include support for both)rust/compiler/rustc_codegen_llvm/src/back/write.rs
Lines 253 to 271 in c419816
rust/compiler/rustc_codegen_ssa/src/back/linker.rs
Lines 759 to 767 in c419816
The default for the flag is to not request debuginfo compression thus users have to opt-in to any level of compression. Zlib compression is widely supported across many versions of binutils and other tools that read debuginfo like
gdb,lldb,perf, etc but zstd compression support is significantly newer and may require using the latest versions of these tools to support it. Users are responsible for ensuring whatever tools they use support the compression algorithm they've requested.Summarize existing test coverage of this feature
Has a call-for-testing period been conducted? If so, what feedback was received?
No call-for-testing has been conducted but Rust for Linux has been using this flag without issue.
What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking?
All reported bugs have been resolved.
Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization
debuginfo_compressionunstable flag #150577 by @wesleywiserWhat FIXMEs are still in the code for that feature and why is it ok to leave them there?
No FIXMEs related to this feature.
What static checks are done that are needed to prevent undefined behavior?
This feature cannot cause undefined behavior.
In what way does this feature interact with the reference/specification, and are those edits prepared?
No changes to reference/spec, the stable book has documentation added as part of this stabilization PR.
Does this feature introduce new expressions and can they produce temporaries? What are the lifetimes of those temporaries?
No.
What other unstable features may be exposed by this feature?
None.
What is tooling support like for this feature, w.r.t rustdoc, clippy, rust-analzyer, rustfmt, etc.?
No support needed for rustdoc, clippy, rust-analyzer, rustfmt or rustup.
Cargo could expose this as an option in build profiles but currently does not.
Closes #120953