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
52
53
54
//! Input files: mapping, format identification and archives.
//!
//! **Workstream W2.** This module owns stages 2 and 3 of the pipeline in
//! `docs/architecture.md`: it turns input specifications into bytes, and the
//! bytes into a format identity.
//!
//! - [`FileTable`] maps input files (`memmap2`), falling back to reading for
//! small or unmappable files, and keeps them alive for the whole link. It
//! hands out `&[u8]` borrowed from the table, accepts in-memory inputs, and
//! loads many files in parallel while assigning [`FileId`]s in input order.
//! Extracted archive members are registered as their own entries.
//! - [`identify()`] recognizes a file by its magic: ELF, COFF objects and short
//! import libraries, PE images, Mach-O, fat binaries, `!<arch>`, `!<thin>`,
//! LLVM bitcode and text. GCC LTO IR is an ELF file with `.gnu.lto_*`
//! sections, which this module does not parse; the ELF reader plugs in a
//! [`GccLtoProbe`] instead.
//! - [`Archive`] reads `ar` archives in the GNU, BSD and thin variants, with
//! the SysV (`/`, `/SYM64/`) and BSD (`__.SYMDEF`, `__.SYMDEF_64`) symbol
//! indexes. Members are not parsed here: the reader yields their names and
//! byte ranges (or paths, for thin archives), and the caller parses them
//! lazily when resolution extracts them.
//! - [`search`] resolves `-l` names and linker-script paths against search
//! directories and the sysroot, through the [`FileSystem`] trait so that
//! tests stay hermetic.
//! - [`source`] lets library callers supply files that exist only in memory
//! ([`InputProvider`], [`MemoryFiles`]); [`FileTable::for_link`] and
//! library search look there before the file system.
//!
//! Mapping needs `unsafe`; it is confined to the private `map` submodule.
//! Everything else treats input as untrusted: no panics, no unchecked
//! arithmetic on offsets, and every malformed structure becomes
//! [`crate::Error::Malformed`].
//!
//! [`FileId`]: crate::FileId
// File mapping; see the module's SAFETY comments.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;