Next: Machine Dependent, Previous: Invocation, Up: Top [Contents][Index]
Every link is controlled by a linker script. This script is written in the linker command language.
The main purpose of the linker script is to describe how the sections in the input files should be mapped into the output file, and to control the memory layout of the output file. Most linker scripts do nothing more than this. However, when necessary, the linker script can also direct the linker to perform many other operations, using the commands described below.
The linker always uses a linker script. If you do not supply one yourself, the linker will use a default script that is compiled into the linker executable. You can use the ‘--verbose’ command line option to display the default linker script. Certain command line options, such as ‘-r’ or ‘-N’, will affect the default linker script.
You may supply your own linker script by using the ‘-T’ command line option. When you do this, your linker script will replace the default linker script.
You may also use linker scripts implicitly by naming them as input files to the linker, as though they were files to be linked. See Implicit Linker Scripts.
• Basic Script Concepts: | Basic Linker Script Concepts | |
• Script Format: | Linker Script Format | |
• Simple Example: | Simple Linker Script Example | |
• Simple Commands: | Simple Linker Script Commands | |
• Assignments: | Assigning Values to Symbols | |
• SECTIONS: | SECTIONS Command | |
• MEMORY: | MEMORY Command | |
• PHDRS: | PHDRS Command | |
• VERSION: | VERSION Command | |
• Expressions: | Expressions in Linker Scripts | |
• Implicit Linker Scripts: | Implicit Linker Scripts |
Next: Machine Dependent, Previous: Invocation, Up: Top [Contents][Index]