• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/share/doc/arm-arm-none-eabi/html/ld.html/
1<html lang="en">
2<head>
3<title>Basic Script Concepts - 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="up" href="Scripts.html#Scripts" title="Scripts">
9<link rel="next" href="Script-Format.html#Script-Format" title="Script Format">
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="Basic-Script-Concepts"></a>
42<p>
43Next:&nbsp;<a rel="next" accesskey="n" href="Script-Format.html#Script-Format">Script Format</a>,
44Up:&nbsp;<a rel="up" accesskey="u" href="Scripts.html#Scripts">Scripts</a>
45<hr>
46</div>
47
48<h3 class="section">3.1 Basic Linker Script Concepts</h3>
49
50<p><a name="index-linker-script-concepts-345"></a>We need to define some basic concepts and vocabulary in order to
51describe the linker script language.
52
53   <p>The linker combines input files into a single output file.  The output
54file and each input file are in a special data format known as an
55<dfn>object file format</dfn>.  Each file is called an <dfn>object file</dfn>. 
56The output file is often called an <dfn>executable</dfn>, but for our
57purposes we will also call it an object file.  Each object file has,
58among other things, a list of <dfn>sections</dfn>.  We sometimes refer to a
59section in an input file as an <dfn>input section</dfn>; similarly, a section
60in the output file is an <dfn>output section</dfn>.
61
62   <p>Each section in an object file has a name and a size.  Most sections
63also have an associated block of data, known as the <dfn>section
64contents</dfn>.  A section may be marked as <dfn>loadable</dfn>, which mean that
65the contents should be loaded into memory when the output file is run. 
66A section with no contents may be <dfn>allocatable</dfn>, which means that an
67area in memory should be set aside, but nothing in particular should be
68loaded there (in some cases this memory must be zeroed out).  A section
69which is neither loadable nor allocatable typically contains some sort
70of debugging information.
71
72   <p>Every loadable or allocatable output section has two addresses.  The
73first is the <dfn>VMA</dfn>, or virtual memory address.  This is the address
74the section will have when the output file is run.  The second is the
75<dfn>LMA</dfn>, or load memory address.  This is the address at which the
76section will be loaded.  In most cases the two addresses will be the
77same.  An example of when they might be different is when a data section
78is loaded into ROM, and then copied into RAM when the program starts up
79(this technique is often used to initialize global variables in a ROM
80based system).  In this case the ROM address would be the LMA, and the
81RAM address would be the VMA.
82
83   <p>You can see the sections in an object file by using the <code>objdump</code>
84program with the &lsquo;<samp><span class="samp">-h</span></samp>&rsquo; option.
85
86   <p>Every object file also has a list of <dfn>symbols</dfn>, known as the
87<dfn>symbol table</dfn>.  A symbol may be defined or undefined.  Each symbol
88has a name, and each defined symbol has an address, among other
89information.  If you compile a C or C++ program into an object file, you
90will get a defined symbol for every defined function and global or
91static variable.  Every undefined function or global variable which is
92referenced in the input file will become an undefined symbol.
93
94   <p>You can see the symbols in an object file by using the <code>nm</code>
95program, or by using the <code>objdump</code> program with the &lsquo;<samp><span class="samp">-t</span></samp>&rsquo;
96option.
97
98   </body></html>
99
100