bu
m
== Relocation table ==
j
The relocation table is a list of [[pointer (computer programming)|pointer]]s created by the translator (a [[compiler]] or [[Assembler (computer programming)#Assembler|assembler]]) and stored in the object or executable file. Each entry in the table, or "fixup", is a [[pointer (computer programming)|pointer]] to an absolute address in the object code that must be changed when the loader relocates the program so that it will refer to the correct ___location. Fixups are designed to support relocation of the program as a complete unit. In some cases, each fixup in the table is itself relative to a base address of zero, so the fixups themselves must be changed as the loader moves through the table.<ref name="Levine_1999_CH1_CH3"/>
j
oj
In some architectures a fixup that crosses certain boundaries (such as a segment boundary) or that is not aligned on a word boundary is illegal and flagged as an error by the linker.<ref name="Borland_2007"/>
o
=== DOS and 16-bit Windows ===
Far [[pointer (computer programming)|pointer]]s ([[32-bit]] pointers with [[x86 memory segmentation|segment]]:offset, used to address 20-bit 640 [[kilobyte|KB]] [[computer storage|memory]] space available to [[DOS]] [[computer program|program]]s), which point to code or data within a [[DOS executable]] ([[EXE]]), do not have absolute segments, because the actual [[memory address|address]] of code/data depends on where the program is loaded in memory and this is not known until the program is loaded.
Instead, segments are relative values in the DOS EXE file. These segments need to be corrected, when the executable has been loaded into memory. The EXE [[loader (computing)|loader]] uses a relocation table to find the segments which need to be adjusted.
=== 32-bit Windows ===
With 32-bit Windows operating systems, it is not mandatory to provide relocation tables for EXE files, since they are the first image loaded into the virtual address space and thus will be loaded at their preferred base address.
For both [[Dynamic Link Library|DLL]]s and for EXEs which opt into [[address space layout randomization]] (ASLR), an [[exploit (computer security)|exploit]] mitigation technique introduced with [[Windows Vista]], relocation tables once again become mandatory because of the possibility that the binary may be dynamically moved before being executed, even though they are still the first thing loaded in the virtual address space.
=== 64-bit Windows ===
When running native 64-bit binaries on Windows Vista and above, ASLR is mandatory{{Citation needed|date=January 2014}}, and thus relocation sections cannot be omitted by the compiler.
=== Unix-like systems ===
The [[Executable and Linkable Format]] (ELF) executable format and shared library format used by most Unix-like systems allows several types of relocation to be defined.<ref name="ELF"/>
== Relocation procedure ==
|