#[non_exhaustive]pub enum X86_64Reloc {
Abs64,
Abs32,
Abs32Signed,
Pc32,
Pc64,
Plt32,
GotPcRel,
GotPcRelX,
RexGotPcRelX,
}Expand description
An x86-64 relocation. Each variant names its ELF counterpart; in the formulas, S is
the target’s address, A the addend, P the address of the patched bytes, L the
address of the target’s PLT entry (or the target itself in a static link), and G
the address of the target’s GOT entry.
§Examples
use object_lang::{RelocationKind, X86_64Reloc};
let kind = RelocationKind::from(X86_64Reloc::Pc32);
assert_eq!(kind.size(), 4);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Abs64
S + A, 64 bits (R_X86_64_64).
Abs32
S + A, 32 bits, zero-extended: must fit in u32 (R_X86_64_32).
Abs32Signed
S + A, 32 bits, sign-extended: must fit in i32 (R_X86_64_32S).
Pc32
S + A - P, 32 bits (R_X86_64_PC32).
Pc64
S + A - P, 64 bits (R_X86_64_PC64).
Plt32
L + A - P, 32 bits: a call or jump to a function (R_X86_64_PLT32).
GotPcRel
G + A - P, 32 bits: a load of the target’s GOT entry (R_X86_64_GOTPCREL).
GotPcRelX
As GotPcRel, and the linker may relax the instruction
to avoid the GOT (R_X86_64_GOTPCRELX).
RexGotPcRelX
As GotPcRelX for an instruction with a REX prefix
(R_X86_64_REX_GOTPCRELX).