Self-relocation

A self-relocating program is a program that relocates its own address-dependent instructions and data when run, and is therefore capable of being loaded into memory at any address.[1] Self-relocating code is a form of self modifying code.

Discussion

Self-relocation is similar to the relocation process employed by the linker-loader when a program is copied from external storage into main memory; the difference is that it is the loaded program rather than the loader that performs the relocation.

As an extreme example of self-relocation it is possible to construct a computer program so that it does not stay at a fixed address in memory, even as it executes. The Apple Worm[2] is a dynamic self-relocator.

References

See also