Expand description
Relocation patchers — pure byte math, compiled (and unit-tested) on EVERY host so the x86-64 patchers are exercised on an arm64 dev machine and vice versa. Each function rewrites one relocation site in a staging buffer given the site’s final runtime address and its target’s address.
Enums§
- Patch
Error - Patch errors carry enough context to identify the failing site.
Functions§
- is_
indirect - Whether this reloc kind resolves through a pointer slot (GOT/IAT/refptr) — the buffer layout must provide one and point the site at it.
- patch_
aarch64_ branch26 - aarch64
b/blimm26: PC-relative, ±128 MiB, 4-byte units. Preserves the opcode bits, rewriting only the immediate. - patch_
aarch64_ page21 - aarch64
adrphi21: the PAGE delta (4 KiB pages), split immlo[30:29] / immhi[23:5]. Range ±4 GiB. - patch_
aarch64_ pageoff12 - aarch64
add/ldrlo12: the low 12 bits of the target, shifted right by the access-size scale for loads/stores. - patch_
abs64 - 8-byte absolute address, little-endian.
- patch_
x64_ rel32 - x86-64 rip-relative disp32 (
jmp/call/lea/mov):disp = target + addend − field_address, with the rip-after-displacement distance already NORMALIZED into the addend at extraction time (ELF bakes it in natively; build.rs adjusts Mach-O and COFF to match).