• 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>Simple Assignments - 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="Assignments.html#Assignments" title="Assignments">
9<link rel="next" href="PROVIDE.html#PROVIDE" title="PROVIDE">
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="Simple-Assignments"></a>
42<p>
43Next:&nbsp;<a rel="next" accesskey="n" href="PROVIDE.html#PROVIDE">PROVIDE</a>,
44Up:&nbsp;<a rel="up" accesskey="u" href="Assignments.html#Assignments">Assignments</a>
45<hr>
46</div>
47
48<h4 class="subsection">3.5.1 Simple Assignments</h4>
49
50<p>You may assign to a symbol using any of the C assignment operators:
51
52     <dl>
53<dt><var>symbol</var><code> = </code><var>expression</var><code> ;</code><dt><var>symbol</var><code> += </code><var>expression</var><code> ;</code><dt><var>symbol</var><code> -= </code><var>expression</var><code> ;</code><dt><var>symbol</var><code> *= </code><var>expression</var><code> ;</code><dt><var>symbol</var><code> /= </code><var>expression</var><code> ;</code><dt><var>symbol</var><code> &lt;&lt;= </code><var>expression</var><code> ;</code><dt><var>symbol</var><code> &gt;&gt;= </code><var>expression</var><code> ;</code><dt><var>symbol</var><code> &amp;= </code><var>expression</var><code> ;</code><dt><var>symbol</var><code> |= </code><var>expression</var><code> ;</code><dd></dl>
54
55   <p>The first case will define <var>symbol</var> to the value of
56<var>expression</var>.  In the other cases, <var>symbol</var> must already be
57defined, and the value will be adjusted accordingly.
58
59   <p>The special symbol name &lsquo;<samp><span class="samp">.</span></samp>&rsquo; indicates the location counter.  You
60may only use this within a <code>SECTIONS</code> command.  See <a href="Location-Counter.html#Location-Counter">Location Counter</a>.
61
62   <p>The semicolon after <var>expression</var> is required.
63
64   <p>Expressions are defined below; see <a href="Expressions.html#Expressions">Expressions</a>.
65
66   <p>You may write symbol assignments as commands in their own right, or as
67statements within a <code>SECTIONS</code> command, or as part of an output
68section description in a <code>SECTIONS</code> command.
69
70   <p>The section of the symbol will be set from the section of the
71expression; for more information, see <a href="Expression-Section.html#Expression-Section">Expression Section</a>.
72
73   <p>Here is an example showing the three different places that symbol
74assignments may be used:
75
76<pre class="smallexample">     floating_point = 0;
77     SECTIONS
78     {
79       .text :
80         {
81           *(.text)
82           _etext = .;
83         }
84       _bdata = (. + 3) &amp; ~ 3;
85       .data : { *(.data) }
86     }
87</pre>
88   <p class="noindent">In this example, the symbol &lsquo;<samp><span class="samp">floating_point</span></samp>&rsquo; will be defined as
89zero.  The symbol &lsquo;<samp><span class="samp">_etext</span></samp>&rsquo; will be defined as the address following
90the last &lsquo;<samp><span class="samp">.text</span></samp>&rsquo; input section.  The symbol &lsquo;<samp><span class="samp">_bdata</span></samp>&rsquo; will be
91defined as the address following the &lsquo;<samp><span class="samp">.text</span></samp>&rsquo; output section aligned
92upward to a 4 byte boundary.
93
94   </body></html>
95
96