Skip to main content

rucc_debug/
lib.rs

1//! DWARF 5 generation.
2//!
3//! Design: `spec/11-asm-objects-debug.md`. Layer rank 10, see `spec/18-package-layout.md`.
4//!
5//! # Status
6//!
7//! Not implemented. This crate exists from the first commit so that the layer rank it holds
8//! is real and `cargo xtask layers` has something to check. The work lands in M8.
9//!
10//! Every crate in the workspace is published, and publishing implies a promise. This one is
11//! tier 3: its Rust API is explicitly unstable and will change without a major version bump.
12//! Depend on the `rucc` binary's behaviour, not on this.
13//!
14//! # Two things already waiting
15//!
16//! `Options::prefix_map` in `rucc-session` holds a `debug` list, which is what
17//! `-fdebug-prefix-map=` and `-ffile-prefix-map=` put there. Every path this crate writes into a
18//! compilation unit, a line table or a file table has to go through `PrefixMap::apply` on the way,
19//! because that is the whole reason a distribution passes those flags and because a build is only
20//! reproducible if all of the paths in it are rewritten rather than most. The driver takes the
21//! flags today and nothing reads that list, which is honest only while there is no DWARF at all.
22//!
23//! `Options::compress` is the other, and it is what `-gz` put there. Every debug section this
24//! crate hands to the object writer has to be compressed the way that field says, which for
25//! `Compress::ZlibGnu` also means the section is named `.zdebug_info` rather than `.debug_info`
26//! and carries a `ZLIB` tag and a length instead of an `Elf64_Chdr`. Compressing the sections is
27//! worth more than anything else a distribution shipping debug symbols passes, so a build that
28//! asked for it and got a file twice the size it expected has a real complaint.
29
30#![doc(html_root_url = "https://docs.rs/rucc-debug/0.10.38")]
31
32/// The milestone in `spec/17-milestones.md` that fills this crate in.
33pub const MILESTONE: &str = "M8";
34
35#[cfg(test)]
36mod tests {
37    #[test]
38    fn milestone_is_recorded() {
39        assert!(super::MILESTONE.starts_with('M'));
40    }
41}