Linux/Unix Command: Id

Tidy up files and symbol references during program compilation with 'ld'

The ld command combines several object and archive files, relocates their data, and ties up symbol references. Usually the last step in compiling a program is to run ld.

Most Linux desktop fans will never run ld. Given its role as part of a broader software-development workflow, there's no casual one-off use for this command.

StartUp Programming Team
vgajic/E+/Getty Images

Ld accepts Linker Command Language files written in a superset of AT&T's Link Editor Command Language syntax, to provide explicit and total control over the linking process. Aside from its flexibility, the GNU linker is more helpful than other linkers in providing diagnostic information. Many linkers abandon execution immediately upon encountering an error; whenever possible, ld continues executing, allowing you to identify other errors (or, in some cases, to get an output file in spite of the error).

The GNU linker ld is meant to cover a broad range of situations, and to be as compatible as possible with other linkers. As a result, you have many choices to control its behavior.  

Consult the manpage for ld for important context about the various options that govern this program's execution.