All books

Professional

Apps About Coach Log in Start reading

Computer Science · Glossary

What is Compiler, object file, linker, executable?

Also known as: compiler · compilation · object file · symbol (of an object file) · linker · executable file · linking · undefined reference

Definition 1.2 University Computer Science — Year 1 · Chapter 1 — From Source Code to a Running Program

A compiler translates a program from one language into another, here from C into the assembly language of the processor; the translation is called compilation. The assembler then encodes the assembly as machine code in an object file: machine code with holes, together with a table of the names it defines and the names it uses. Each name in that table is a symbol. The linker combines object files and libraries into one executable file, a file the operating system can load and start; this step is linking, and a used symbol that no input defines is an undefined reference.

The four stages of a C build. Each arrow is a separate program; gcc runs them in turn, and the options -E, -S and -c stop it after the first, second or third. The linker fills the holes left in the object file with the addresses of the library’s code.
The four stages of a C build. Each arrow is a separate program; gcc runs them in turn, and the options -E, -S and -c stop it after the first, second or third. The linker fills the holes left in the object file with the addresses of the library’s code.

Examples

Read in context →