Quiz Entry - updated: 2026.07.14
What are the main x86_64 relocation types?
Two PC-relative kinds (R_X86_64_PC32 for nearby code/data, PLT32 for calls routed through the PLT) and two absolute kinds (32[S] and the full 64-bit 64).
* The split that matters: PC-relative types encode an offset from the instruction pointer, absolute types encode the address directly. *
| Relocation Type | Addressing | Formula |
|---|---|---|
| R_X86_64_PC32 | PC-relative | PC + 4-byte offset → object |
| R_X86_64_PLT32 | PC-relative | PC + 4-byte offset → PLT entry |
| R_X86_64_32[S] | Absolute | 4-byte address → object |
| R_X86_64_64 | Absolute | 8-byte address → object |
PC-relative (most common):
- Address = current_PC + encoded_offset
- Used for function calls and nearby data
- Works within ±2GB (small code model)
Absolute:
- Address is directly encoded
- Used for global data pointers
- R_X86_64_32S: sign-extended 32-bit
- R_X86_64_64: full 64-bit address
PLT (Procedure Linkage Table):
- Used for calls that go through the PLT — external functions, including those in shared libraries
- Enables lazy binding (resolve on first call) for dynamically-linked calls
Go deeper:
Eli Bendersky — Position-independent code (PIC) in shared libraries — how PC-relative and PLT relocations actually resolve, with disassembly.