{
  "id": "wire-format/elf-relocation",
  "family": "wire-format",
  "slug": "elf-relocation",
  "title": "ELF relocation types (x86-64)",
  "summary": "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).",
  "kind": "wire-format",
  "aliases": [
    "ELF relocation types (x86-64)"
  ],
  "status": "standard",
  "verification": "verified",
  "tier": "B",
  "source_url": "https://en.wikipedia.org/wiki/Relocation_(computing)",
  "source_version": "retrieved 2026-05-29",
  "retrieved_date": "2026-05-29",
  "ext_type": "wire-format@1",
  "ext": {
    "spec": "System V ABI (AMD64)",
    "summary": "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).",
    "structure": [
      {
        "field": "R_X86_64_NONE",
        "size": "0",
        "meaning": "No relocation."
      },
      {
        "field": "R_X86_64_64",
        "size": "1",
        "meaning": "S + A (absolute 64-bit address)."
      },
      {
        "field": "R_X86_64_PC32",
        "size": "2",
        "meaning": "S + A - P (PC-relative 32-bit). Used for calls/jumps."
      },
      {
        "field": "R_X86_64_GOT32",
        "size": "3",
        "meaning": "G + A (GOT entry offset)."
      },
      {
        "field": "R_X86_64_PLT32",
        "size": "4",
        "meaning": "L + A - P (PLT entry, for lazy binding)."
      },
      {
        "field": "R_X86_64_COPY",
        "size": "5",
        "meaning": "Copy symbol data (for shared library data). Used for R_386_COPY."
      },
      {
        "field": "R_X86_64_GLOB_DAT",
        "size": "6",
        "meaning": "S (global data symbol, for GOT)."
      },
      {
        "field": "R_X86_64_JUMP_SLOT",
        "size": "7",
        "meaning": "S (function pointer, for PLT/GOT)."
      },
      {
        "field": "R_X86_64_RELATIVE",
        "size": "8",
        "meaning": "B + A (base + offset, for PIE/shared libs)."
      },
      {
        "field": "R_X86_64_32",
        "size": "10",
        "meaning": "S + A (zero-extended 32-bit)."
      },
      {
        "field": "R_X86_64_32S",
        "size": "11",
        "meaning": "S + A (sign-extended 32-bit)."
      },
      {
        "field": "R_X86_64_16",
        "size": "12",
        "meaning": "S + A (16-bit)."
      },
      {
        "field": "R_X86_64_PC64",
        "size": "24",
        "meaning": "S + A - P (PC-relative 64-bit)."
      },
      {
        "field": "R_X86_64_GOTPCREL",
        "size": "9",
        "meaning": "G + GOT + A - P (GOT PC-relative, most common for data access)."
      }
    ],
    "example_hex": "00 00 00 00",
    "example_decoded": "ELF relocations (placeholder)",
    "notes": [
      "Relocations are applied by the linker (static) or dynamic loader (runtime).",
      "GOT (Global Offset Table) enables position-independent code.",
      "PLT (Procedure Linkage Table) enables lazy binding of shared library functions.",
      "RELATIVE relocations are the most common in PIE/shared libraries.",
      "Relocation types are architecture-specific."
    ]
  },
  "updated": "2026-05-29"
}
