9.1 Overview of Linker Scripts

Linker scripts control all aspects of the link process, including:
  • allocation of data memory and program memory
  • mapping of sections from input files into the output file
  • construction of special data structures (such as interrupt vector tables)

Linker scripts are text files that contain a series of commands. Each command is either a keyword, possibly followed by arguments, or an assignment to a symbol.

Typically, two linker scripts are used to fully define how a program should be linked. The main linker script will have an extension that is or begins with x, for example elf32pic32c.x or elf32pic32mx.xe and copies of these are located in the family/lib/ldscripts directories of your compiler distribution. Device-specific fragments of the linker scripts have a .ld extension and copies of these are located in the family/lib/proc/device directories.