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
//! Section-name lookup helper for `__swift5_*` sections.
//!
//! Cite: `RESEARCH.md` ยง"Section overview" (line 1696). The
//! canonical segment for every Swift reflection section is `__TEXT`
//! (per `swift/include/swift/ABI/ObjectFile.h:62`'s
//! `sectionContainsReflectionData` predicate), but linker variants
//! occasionally place individual sections under `__DATA_CONST` or
//! `__const`. The lookup therefore matches **section name only** -
//! the segment is informational. This mirrors the ObjC convention in
//! [`crate::objc::section`].
use crateMachoBinary;
/// On-disk view of one Swift metadata section.
///
/// Holds the raw section body and the VM address it maps to so that
/// the walkers can translate a relative offset within the section
/// (`body_offset`) into an absolute VM address (`vmaddr + offset`)
/// without re-scanning the segment table.
pub
/// Locate a Swift metadata section by canonical name.
///
/// `name` must include the leading `__swift5_` (e.g. `"__swift5_types"`).
/// The matcher is segment-agnostic per the section-name catalogue
/// (`RESEARCH.md:1721-1723`); the linker's choice of `__TEXT` vs
/// `__DATA_CONST` does not affect identity.
///
/// Returns `None` when no section with the given name exists.
pub