Contents|Index|Previous|Next

Linker Scripts

The ld command language is a collection of statements; some are simple keywords setting a particular option, some are used to select and group input files or name output files; and two statement types have a fundamental and pervasive impact on the linking process.

The most fundamental command of the ld command language is the SECTIONS command (see Specifying Output Sections). Every meaningful command script must have a SECTIONS command; it specifies a “picture” of the output file’s layout, in varying degrees of detail. No other command is required in all cases.

The MEMORY command complements SECTIONS by describing the available memory in the target architecture. This command is optional; if you don’t use a MEMORY command, ld assumes sufficient memory is available in a contiguous block for all output. See Memory Layout.

You may include comments in linker scripts just as in C: delimited by ‘/*’ and ‘*/’. As in C, comments are syntactically equivalent to whitespace.