rucc_object/lib.rs
1//! ELF, Mach-O and COFF object writers.
2//!
3//! Design: `spec/11-asm-objects-debug.md`. Layer rank 8, see `spec/18-package-layout.md`.
4//!
5//! # Status
6//!
7//! ELF, which is what Linux and the freestanding targets want and what M3 needs. A text section,
8//! the symbols that say where each function in it is and how long it is, the names it wanted that
9//! are not in it, the relocations that ask a linker to find them, and the marker whose absence
10//! makes the stack executable. An object this writes links with the system linker and runs.
11//!
12//! What it is given is [`Text`], which is here rather than beside the assembler that fills it in
13//! because it is what an object file is made of and because a writer cannot depend on the thing
14//! that produces its input without the layer graph going the wrong way round.
15//!
16//! Mach-O and COFF are not written yet, and neither is any section other than the text. Both wait
17//! on the target and the global variables that need them.
18//!
19//! Every crate in the workspace is published, and publishing implies a promise. This one is
20//! tier 3: its Rust API is explicitly unstable and will change without a major version bump.
21//! Depend on the `rucc` binary's behaviour, not on this.
22
23#![doc(html_root_url = "https://docs.rs/rucc-object/0.3.6")]
24
25mod elf;
26mod section;
27
28pub use crate::elf::{Error, write};
29pub use crate::section::{Extent, Reference, Reloc, Text};
30
31/// The milestone in `spec/17-milestones.md` that fills this crate in.
32pub const MILESTONE: &str = "M3";
33
34#[cfg(test)]
35mod tests {
36 #[test]
37 fn milestone_is_recorded() {
38 assert!(super::MILESTONE.starts_with('M'));
39 }
40}