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
55
56
57
58
59
60
61
//! Linker-script-driven layout (roadmap M3).
//!
//! **Workstream W19.** This module runs layout from a linker script, the way
//! GNU ld does, while the rest of the ELF pipeline stays the same:
//!
//! 1. [`prepare`] ([`load`]) reads `-T` scripts, `--default-script`,
//! implicit scripts named as inputs and `-b binary` inputs before the
//! inputs are collected, applies script commands that are options
//! (`ENTRY`, `OUTPUT_FORMAT`, `SEARCH_DIR`, ...), and builds the
//! [`LayoutScript`] ([`plan`]). When `INSERT`, implicit scripts or layout
//! options (`-Ttext`, `-N`, ...) need the default layout underneath, it is
//! the built-in script of [`defaults`].
//! 2. [`place`] ([`matching`]) assigns input sections to output section
//! statements and places orphans, instead of [`crate::elf::rules`].
//! 3. [`crate::elf::defined::register`] resolves the symbols scripts assign
//! and read.
//! 4. [`layout`] ([`engine`]) assigns addresses and load addresses by
//! walking the statements, repeating until stable, then builds program
//! headers and file offsets ([`segments`]).
//!
//! Without scripts and layout options, the default rules and layout of
//! [`crate::elf::rules`] and [`crate::elf::layout`] are used unchanged.
//!
//! Relocatable links (`-r`) with a script use [`relocatable`] instead of
//! steps 3 and 4: sections are matched the same way, then laid out without
//! addresses for [`crate::elf::relocatable`] to write.
pub use ;
pub use ;
pub use ;
pub use LayoutScript;
/// The bytes a linker-script data statement (`BYTE`, `SHORT`, `LONG`,
/// `QUAD`) of `width` bytes writes for `value`, in the output's byte
/// order: its low bytes, first in a little-endian output and last in a
/// big-endian one.