wire / wire-format / elf-relocation
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).
aka: ELF relocation types (x86-64)
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).
| field | size | meaning |
|---|---|---|
| R_X86_64_NONE | 0 | No relocation. |
| R_X86_64_64 | 1 | S + A (absolute 64-bit address). |
| R_X86_64_PC32 | 2 | S + A - P (PC-relative 32-bit). Used for calls/jumps. |
| R_X86_64_GOT32 | 3 | G + A (GOT entry offset). |
| R_X86_64_PLT32 | 4 | L + A - P (PLT entry, for lazy binding). |
| R_X86_64_COPY | 5 | Copy symbol data (for shared library data). Used for R_386_COPY. |
| R_X86_64_GLOB_DAT | 6 | S (global data symbol, for GOT). |
| R_X86_64_JUMP_SLOT | 7 | S (function pointer, for PLT/GOT). |
| R_X86_64_RELATIVE | 8 | B + A (base + offset, for PIE/shared libs). |
| R_X86_64_32 | 10 | S + A (zero-extended 32-bit). |
| R_X86_64_32S | 11 | S + A (sign-extended 32-bit). |
| R_X86_64_16 | 12 | S + A (16-bit). |
| R_X86_64_PC64 | 24 | S + A - P (PC-relative 64-bit). |
| R_X86_64_GOTPCREL | 9 | G + GOT + A - P (GOT PC-relative, most common for data access). |
example:
00 00 00 00
ELF relocations (placeholder)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/elf-relocation
or /wire-format/elf-relocation.json