wire / wire-format / elf-relocation

ELF relocation types (x86-64)

ELF relocations tell the linker/loader how to patch addresses. Common x86-64 relocation types: R_X86_64_NONE (0), R_X86_64_64 (1, S + A), R_X86_64_PC32 (2, S + A - P), R_X86_64_GOT32 (3), R_X86_64_PLT32 (4), R_X86_64_COPY (5), R_X86_64_GLOB_DAT (6), R_X86_64_JUMP_SLOT (7), R_X86_64_RELATIVE (8, B + A), R_X86_64_32 (10), R_X86_64_32S (11), R_X86_64_16 (12), R_X86_64_PC64 (24), R_X86_64_GOTOFF64 (25), R_X86_64_GOTPC32 (26), R_X86_64_GOT64 (27).

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: ELF relocation types (x86-64)

wire format

spec: System V ABI (AMD64)

ELF relocations tell the linker/loader how to patch addresses. Common x86-64 relocation types: R_X86_64_NONE (0), R_X86_64_64 (1, S + A), R_X86_64_PC32 (2, S + A - P), R_X86_64_GOT32 (3), R_X86_64_PLT32 (4), R_X86_64_COPY (5), R_X86_64_GLOB_DAT (6), R_X86_64_JUMP_SLOT (7), R_X86_64_RELATIVE (8, B + A), R_X86_64_32 (10), R_X86_64_32S (11), R_X86_64_16 (12), R_X86_64_PC64 (24), R_X86_64_GOTOFF64 (25), R_X86_64_GOTPC32 (26), R_X86_64_GOT64 (27).

fieldsizemeaning
R_X86_64_NONE0No relocation.
R_X86_64_641S + A (absolute 64-bit address).
R_X86_64_PC322S + A - P (PC-relative 32-bit). Used for calls/jumps.
R_X86_64_GOT323G + A (GOT entry offset).
R_X86_64_PLT324L + A - P (PLT entry, for lazy binding).
R_X86_64_COPY5Copy symbol data (for shared library data). Used for R_386_COPY.
R_X86_64_GLOB_DAT6S (global data symbol, for GOT).
R_X86_64_JUMP_SLOT7S (function pointer, for PLT/GOT).
R_X86_64_RELATIVE8B + A (base + offset, for PIE/shared libs).
R_X86_64_3210S + A (zero-extended 32-bit).
R_X86_64_32S11S + A (sign-extended 32-bit).
R_X86_64_1612S + A (16-bit).
R_X86_64_PC6424S + A - P (PC-relative 64-bit).
R_X86_64_GOTPCREL9G + GOT + A - P (GOT PC-relative, most common for data access).

example:

00 00 00 00

ELF relocations (placeholder)


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/elf-relocation or /wire-format/elf-relocation.json