neingeist
/
arduinisten
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

93 lines
4.3 KiB
HTML

<html lang="en">
<head>
<title>Simple Assignments - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Assignments.html#Assignments" title="Assignments">
<link rel="next" href="PROVIDE.html#PROVIDE" title="PROVIDE">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU linker LD
(GNU Binutils)
version 2.19.
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family: serif; font-weight: normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Simple-Assignments"></a>Next:&nbsp;<a rel="next" accesskey="n" href="PROVIDE.html#PROVIDE">PROVIDE</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Assignments.html#Assignments">Assignments</a>
<hr><br>
</div>
<h4 class="subsection">3.5.1 Simple Assignments</h4>
<p>You may assign to a symbol using any of the C assignment operators:
<dl>
<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>
<p>The first case will define <var>symbol</var> to the value of
<var>expression</var>. In the other cases, <var>symbol</var> must already be
defined, and the value will be adjusted accordingly.
<p>The special symbol name <span class="samp">.</span> indicates the location counter. You
may only use this within a <code>SECTIONS</code> command. See <a href="Location-Counter.html#Location-Counter">Location Counter</a>.
<p>The semicolon after <var>expression</var> is required.
<p>Expressions are defined below; see <a href="Expressions.html#Expressions">Expressions</a>.
<p>You may write symbol assignments as commands in their own right, or as
statements within a <code>SECTIONS</code> command, or as part of an output
section description in a <code>SECTIONS</code> command.
<p>The section of the symbol will be set from the section of the
expression; for more information, see <a href="Expression-Section.html#Expression-Section">Expression Section</a>.
<p>Here is an example showing the three different places that symbol
assignments may be used:
<pre class="smallexample"> floating_point = 0;
SECTIONS
{
.text :
{
*(.text)
_etext = .;
}
_bdata = (. + 3) &amp; ~ 3;
.data : { *(.data) }
}
</pre>
<p class="noindent">In this example, the symbol <span class="samp">floating_point</span> will be defined as
zero. The symbol <span class="samp">_etext</span> will be defined as the address following
the last <span class="samp">.text</span> input section. The symbol <span class="samp">_bdata</span> will be
defined as the address following the <span class="samp">.text</span> output section aligned
upward to a 4 byte boundary.
</body></html>