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