Object file (source code)

= Object file
{wiki}

An <object file> stores program components produced by a <compiler> or <assembler>, together with information needed to combine or load them. A relocatable <object file> commonly contains machine instructions and data divided into sections, named symbols, and relocation records for references whose final locations are not yet known.<Sections and Relocation in the GNU Assembler manual>[§4.1 Background: sections and address adjustments; assembler relocation information]{ref}

For example, compiling a file that calls `square` can produce an <object file> containing the call-site instruction and an unresolved reference to that symbol. The <linker (computing)> later supplies its definition from another input. The file thus contains more than the bytes of a self-contained runnable program: its metadata describes how incomplete components fit together.