1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- This file documents the GNU linker LD 4(GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 5version 2.36.1. 6 7Copyright (C) 1991-2021 Free Software Foundation, Inc. 8 9Permission is granted to copy, distribute and/or modify this document 10under the terms of the GNU Free Documentation License, Version 1.3 11or any later version published by the Free Software Foundation; 12with no Invariant Sections, with no Front-Cover Texts, and with no 13Back-Cover Texts. A copy of the license is included in the 14section entitled "GNU Free Documentation License". --> 15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 16<head> 17<title>LD: Scripts</title> 18 19<meta name="description" content="LD: Scripts"> 20<meta name="keywords" content="LD: Scripts"> 21<meta name="resource-type" content="document"> 22<meta name="distribution" content="global"> 23<meta name="Generator" content="makeinfo"> 24<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 25<link href="index.html#Top" rel="start" title="Top"> 26<link href="LD-Index.html#LD-Index" rel="index" title="LD Index"> 27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 28<link href="index.html#Top" rel="up" title="Top"> 29<link href="Basic-Script-Concepts.html#Basic-Script-Concepts" rel="next" title="Basic Script Concepts"> 30<link href="Environment.html#Environment" rel="previous" title="Environment"> 31<style type="text/css"> 32<!-- 33a.summary-letter {text-decoration: none} 34blockquote.smallquotation {font-size: smaller} 35div.display {margin-left: 3.2em} 36div.example {margin-left: 3.2em} 37div.indentedblock {margin-left: 3.2em} 38div.lisp {margin-left: 3.2em} 39div.smalldisplay {margin-left: 3.2em} 40div.smallexample {margin-left: 3.2em} 41div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 42div.smalllisp {margin-left: 3.2em} 43kbd {font-style:oblique} 44pre.display {font-family: inherit} 45pre.format {font-family: inherit} 46pre.menu-comment {font-family: serif} 47pre.menu-preformatted {font-family: serif} 48pre.smalldisplay {font-family: inherit; font-size: smaller} 49pre.smallexample {font-size: smaller} 50pre.smallformat {font-family: inherit; font-size: smaller} 51pre.smalllisp {font-size: smaller} 52span.nocodebreak {white-space:nowrap} 53span.nolinebreak {white-space:nowrap} 54span.roman {font-family:serif; font-weight:normal} 55span.sansserif {font-family:sans-serif; font-weight:normal} 56ul.no-bullet {list-style: none} 57--> 58</style> 59 60 61</head> 62 63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 64<a name="Scripts"></a> 65<div class="header"> 66<p> 67Next: <a href="Plugins.html#Plugins" accesskey="n" rel="next">Plugins</a>, Previous: <a href="Invocation.html#Invocation" accesskey="p" rel="previous">Invocation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p> 68</div> 69<hr> 70<a name="Linker-Scripts"></a> 71<h2 class="chapter">3 Linker Scripts</h2> 72 73<a name="index-scripts"></a> 74<a name="index-linker-scripts"></a> 75<a name="index-command-files"></a> 76<p>Every link is controlled by a <em>linker script</em>. This script is 77written in the linker command language. 78</p> 79<p>The main purpose of the linker script is to describe how the sections in 80the input files should be mapped into the output file, and to control 81the memory layout of the output file. Most linker scripts do nothing 82more than this. However, when necessary, the linker script can also 83direct the linker to perform many other operations, using the commands 84described below. 85</p> 86<p>The linker always uses a linker script. If you do not supply one 87yourself, the linker will use a default script that is compiled into the 88linker executable. You can use the ‘<samp>--verbose</samp>’ command-line option 89to display the default linker script. Certain command-line options, 90such as ‘<samp>-r</samp>’ or ‘<samp>-N</samp>’, will affect the default linker script. 91</p> 92<p>You may supply your own linker script by using the ‘<samp>-T</samp>’ command 93line option. When you do this, your linker script will replace the 94default linker script. 95</p> 96<p>You may also use linker scripts implicitly by naming them as input files 97to the linker, as though they were files to be linked. See <a href="Implicit-Linker-Scripts.html#Implicit-Linker-Scripts">Implicit Linker Scripts</a>. 98</p> 99<table class="menu" border="0" cellspacing="0"> 100<tr><td align="left" valign="top">• <a href="Basic-Script-Concepts.html#Basic-Script-Concepts" accesskey="1">Basic Script Concepts</a>:</td><td> </td><td align="left" valign="top">Basic Linker Script Concepts 101</td></tr> 102<tr><td align="left" valign="top">• <a href="Script-Format.html#Script-Format" accesskey="2">Script Format</a>:</td><td> </td><td align="left" valign="top">Linker Script Format 103</td></tr> 104<tr><td align="left" valign="top">• <a href="Simple-Example.html#Simple-Example" accesskey="3">Simple Example</a>:</td><td> </td><td align="left" valign="top">Simple Linker Script Example 105</td></tr> 106<tr><td align="left" valign="top">• <a href="Simple-Commands.html#Simple-Commands" accesskey="4">Simple Commands</a>:</td><td> </td><td align="left" valign="top">Simple Linker Script Commands 107</td></tr> 108<tr><td align="left" valign="top">• <a href="Assignments.html#Assignments" accesskey="5">Assignments</a>:</td><td> </td><td align="left" valign="top">Assigning Values to Symbols 109</td></tr> 110<tr><td align="left" valign="top">• <a href="SECTIONS.html#SECTIONS" accesskey="6">SECTIONS</a>:</td><td> </td><td align="left" valign="top">SECTIONS Command 111</td></tr> 112<tr><td align="left" valign="top">• <a href="MEMORY.html#MEMORY" accesskey="7">MEMORY</a>:</td><td> </td><td align="left" valign="top">MEMORY Command 113</td></tr> 114<tr><td align="left" valign="top">• <a href="PHDRS.html#PHDRS" accesskey="8">PHDRS</a>:</td><td> </td><td align="left" valign="top">PHDRS Command 115</td></tr> 116<tr><td align="left" valign="top">• <a href="VERSION.html#VERSION" accesskey="9">VERSION</a>:</td><td> </td><td align="left" valign="top">VERSION Command 117</td></tr> 118<tr><td align="left" valign="top">• <a href="Expressions.html#Expressions">Expressions</a>:</td><td> </td><td align="left" valign="top">Expressions in Linker Scripts 119</td></tr> 120<tr><td align="left" valign="top">• <a href="Implicit-Linker-Scripts.html#Implicit-Linker-Scripts">Implicit Linker Scripts</a>:</td><td> </td><td align="left" valign="top">Implicit Linker Scripts 121</td></tr> 122</table> 123 124<hr> 125<div class="header"> 126<p> 127Next: <a href="Plugins.html#Plugins" accesskey="n" rel="next">Plugins</a>, Previous: <a href="Invocation.html#Invocation" accesskey="p" rel="previous">Invocation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p> 128</div> 129 130 131 132</body> 133</html> 134