1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Output file writing and post-write steps.
//!
//! **Workstream W5.** Responsibilities:
//!
//! - Create the output next to its final path and set its length. Contents
//! are written with positional writes by default ([`Backing::Written`]);
//! mapping the file ([`Backing::Mapped`]) and an in-memory buffer
//! ([`Backing::Memory`], also used for pipes, devices and library callers
//! who want bytes back) are the alternatives.
//! [`LinkOptions::output_backing`](crate::args::LinkOptions::output_backing)
//! overrides the choice for benchmarking; the `qld` binary sets it from
//! `QLD_OUTPUT_BACKING`.
//! - Hand out disjoint `&mut [u8]` chunks so sections can be copied and
//! relocated in parallel.
//! - Post-write steps: build-id (hash blocks in parallel, then combine),
//! Mach-O code signature, fat header.
//! - Set the executable bit, and replace the old file atomically.
//!
//! This module and [`crate::input`] are the only places allowed to use
//! `unsafe`, for mapping. Every block needs a `SAFETY` comment.
//! See `docs/architecture.md` ("Output writing").
//!
//! # Overview
//!
//! | Item | Role |
//! | --- | --- |
//! | [`OutputFile`] | Creates, maps, fills and commits the output; its docs cover how an old file is replaced |
//! | [`split_chunks`], [`write_chunks`] | Disjoint `&mut [u8]` per layout chunk, for rayon |
//! | [`build_id`] | Parallel tree-hashed build-ids: `fast`, `md5`, `sha1`, `uuid`, hex |
//! | [`hash`] | In-crate MD5, SHA-1 and xxHash64 |
//! | [`WriteStats`] | Bytes written and time per [`WritePhase`] |
//!
//! Mapping lives in a private submodule that is the only code here allowed to
//! use `unsafe`.
//!
//! Not implemented yet: the Mach-O code signature and the fat header
//! (roadmap M8).
pub use ;
pub use ;
pub use ;