Relocation table
The relocation table is a list of pointers created by the linker and linked into the MSDOS .exe file. The relocation table tells the loader where these segments can be found in program image loaded into memory.
Explanation
Far pointers (32-bit pointers with segment:offset, used to address 20-bit 640 KB memory space available to DOS programs), which point to code or data within an DOS executable (EXE) do not have absolute segments, because the actual 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 uses a relocation table to find the segments which need to be adjusted.
32-bit Windows Program Files
![]() | This article needs to be updated. |
With the advent of 32-bit operating systems, and EXE files conforming to the PE format (Portable Executable) format, relocation table are no longer required or used in EXE files. This is because of virtual addressing - the EXE can be loaded into any address in the virtual space, so it is always loaded at its base address, and therefore pointers don't have to be adjusted. Still, relocations are required in DLL libraries, because they're loaded into address space of existing process, and there's no guarantee that their base address will be free when they are being loaded.
Some older compilers and linkers still do create windows EXE files with relocation tables.
Unix/Linux systems
The ELF executable format and SO shared library format used by most Unix/Linux systems allows to define several types of relocations.
See also
External links