1<html lang="en"> 2<head> 3<title>Scripts - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="Invocation.html#Invocation" title="Invocation"> 9<link rel="next" href="Machine-Dependent.html#Machine-Dependent" title="Machine Dependent"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12This file documents the GNU linker LD 13(Sourcery CodeBench Lite 2013.11-24) 14version 2.23.52. 15 16Copyright (C) 1991-2013 Free Software Foundation, Inc. 17 18Permission is granted to copy, distribute and/or modify this document 19under the terms of the GNU Free Documentation License, Version 1.3 20or any later version published by the Free Software Foundation; 21with no Invariant Sections, with no Front-Cover Texts, and with no 22Back-Cover Texts. A copy of the license is included in the 23section entitled ``GNU Free Documentation License''.--> 24<meta http-equiv="Content-Style-Type" content="text/css"> 25<style type="text/css"><!-- 26 pre.display { font-family:inherit } 27 pre.format { font-family:inherit } 28 pre.smalldisplay { font-family:inherit; font-size:smaller } 29 pre.smallformat { font-family:inherit; font-size:smaller } 30 pre.smallexample { font-size:smaller } 31 pre.smalllisp { font-size:smaller } 32 span.sc { font-variant:small-caps } 33 span.roman { font-family:serif; font-weight:normal; } 34 span.sansserif { font-family:sans-serif; font-weight:normal; } 35--></style> 36<link rel="stylesheet" type="text/css" href="../cs.css"> 37</head> 38<body> 39<div class="node"> 40<a name="Scripts"></a> 41<p> 42Next: <a rel="next" accesskey="n" href="Machine-Dependent.html#Machine-Dependent">Machine Dependent</a>, 43Previous: <a rel="previous" accesskey="p" href="Invocation.html#Invocation">Invocation</a>, 44Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 45<hr> 46</div> 47 48<h2 class="chapter">3 Linker Scripts</h2> 49 50<p><a name="index-scripts-349"></a><a name="index-linker-scripts-350"></a><a name="index-command-files-351"></a>Every link is controlled by a <dfn>linker script</dfn>. This script is 51written in the linker command language. 52 53 <p>The main purpose of the linker script is to describe how the sections in 54the input files should be mapped into the output file, and to control 55the memory layout of the output file. Most linker scripts do nothing 56more than this. However, when necessary, the linker script can also 57direct the linker to perform many other operations, using the commands 58described below. 59 60 <p>The linker always uses a linker script. If you do not supply one 61yourself, the linker will use a default script that is compiled into the 62linker executable. You can use the ‘<samp><span class="samp">--verbose</span></samp>’ command line option 63to display the default linker script. Certain command line options, 64such as ‘<samp><span class="samp">-r</span></samp>’ or ‘<samp><span class="samp">-N</span></samp>’, will affect the default linker script. 65 66 <p>You may supply your own linker script by using the ‘<samp><span class="samp">-T</span></samp>’ command 67line option. When you do this, your linker script will replace the 68default linker script. 69 70 <p>You may also use linker scripts implicitly by naming them as input files 71to the linker, as though they were files to be linked. See <a href="Implicit-Linker-Scripts.html#Implicit-Linker-Scripts">Implicit Linker Scripts</a>. 72 73<ul class="menu"> 74<li><a accesskey="1" href="Basic-Script-Concepts.html#Basic-Script-Concepts">Basic Script Concepts</a>: Basic Linker Script Concepts 75<li><a accesskey="2" href="Script-Format.html#Script-Format">Script Format</a>: Linker Script Format 76<li><a accesskey="3" href="Simple-Example.html#Simple-Example">Simple Example</a>: Simple Linker Script Example 77<li><a accesskey="4" href="Simple-Commands.html#Simple-Commands">Simple Commands</a>: Simple Linker Script Commands 78<li><a accesskey="5" href="Assignments.html#Assignments">Assignments</a>: Assigning Values to Symbols 79<li><a accesskey="6" href="SECTIONS.html#SECTIONS">SECTIONS</a>: SECTIONS Command 80<li><a accesskey="7" href="MEMORY.html#MEMORY">MEMORY</a>: MEMORY Command 81<li><a accesskey="8" href="PHDRS.html#PHDRS">PHDRS</a>: PHDRS Command 82<li><a accesskey="9" href="VERSION.html#VERSION">VERSION</a>: VERSION Command 83<li><a href="Expressions.html#Expressions">Expressions</a>: Expressions in Linker Scripts 84<li><a href="Implicit-Linker-Scripts.html#Implicit-Linker-Scripts">Implicit Linker Scripts</a>: Implicit Linker Scripts 85</ul> 86 87 </body></html> 88 89