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.

106 lines
5.8 KiB
HTML

<html lang="en">
<head>
<title>Output Section Data - 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="SECTIONS.html#SECTIONS" title="SECTIONS">
<link rel="prev" href="Input-Section.html#Input-Section" title="Input Section">
<link rel="next" href="Output-Section-Keywords.html#Output-Section-Keywords" title="Output Section Keywords">
<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="Output-Section-Data"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Output-Section-Keywords.html#Output-Section-Keywords">Output Section Keywords</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Input-Section.html#Input-Section">Input Section</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="SECTIONS.html#SECTIONS">SECTIONS</a>
<hr><br>
</div>
<h4 class="subsection">3.6.5 Output Section Data</h4>
<p><a name="index-data-383"></a><a name="index-section-data-384"></a><a name="index-output-section-data-385"></a><a name="index-BYTE_0028_0040var_007bexpression_007d_0029-386"></a><a name="index-SHORT_0028_0040var_007bexpression_007d_0029-387"></a><a name="index-LONG_0028_0040var_007bexpression_007d_0029-388"></a><a name="index-QUAD_0028_0040var_007bexpression_007d_0029-389"></a><a name="index-SQUAD_0028_0040var_007bexpression_007d_0029-390"></a>You can include explicit bytes of data in an output section by using
<code>BYTE</code>, <code>SHORT</code>, <code>LONG</code>, <code>QUAD</code>, or <code>SQUAD</code> as
an output section command. Each keyword is followed by an expression in
parentheses providing the value to store (see <a href="Expressions.html#Expressions">Expressions</a>). The
value of the expression is stored at the current value of the location
counter.
<p>The <code>BYTE</code>, <code>SHORT</code>, <code>LONG</code>, and <code>QUAD</code> commands
store one, two, four, and eight bytes (respectively). After storing the
bytes, the location counter is incremented by the number of bytes
stored.
<p>For example, this will store the byte 1 followed by the four byte value
of the symbol <span class="samp">addr</span>:
<pre class="smallexample"> BYTE(1)
LONG(addr)
</pre>
<p>When using a 64 bit host or target, <code>QUAD</code> and <code>SQUAD</code> are the
same; they both store an 8 byte, or 64 bit, value. When both host and
target are 32 bits, an expression is computed as 32 bits. In this case
<code>QUAD</code> stores a 32 bit value zero extended to 64 bits, and
<code>SQUAD</code> stores a 32 bit value sign extended to 64 bits.
<p>If the object file format of the output file has an explicit endianness,
which is the normal case, the value will be stored in that endianness.
When the object file format does not have an explicit endianness, as is
true of, for example, S-records, the value will be stored in the
endianness of the first input object file.
<p>Note&mdash;these commands only work inside a section description and not
between them, so the following will produce an error from the linker:
<pre class="smallexample"> SECTIONS { .text : { *(.text) } LONG(1) .data : { *(.data) } }</pre>
<p>whereas this will work:
<pre class="smallexample"> SECTIONS { .text : { *(.text) ; LONG(1) } .data : { *(.data) } }</pre>
<p><a name="index-FILL_0028_0040var_007bexpression_007d_0029-391"></a><a name="index-holes_002c-filling-392"></a><a name="index-unspecified-memory-393"></a>You may use the <code>FILL</code> command to set the fill pattern for the
current section. It is followed by an expression in parentheses. Any
otherwise unspecified regions of memory within the section (for example,
gaps left due to the required alignment of input sections) are filled
with the value of the expression, repeated as
necessary. A <code>FILL</code> statement covers memory locations after the
point at which it occurs in the section definition; by including more
than one <code>FILL</code> statement, you can have different fill patterns in
different parts of an output section.
<p>This example shows how to fill unspecified regions of memory with the
value <span class="samp">0x90</span>:
<pre class="smallexample"> FILL(0x90909090)
</pre>
<p>The <code>FILL</code> command is similar to the <span class="samp">=</span><var>fillexp</var> output
section attribute, but it only affects the
part of the section following the <code>FILL</code> command, rather than the
entire section. If both are used, the <code>FILL</code> command takes
precedence. See <a href="Output-Section-Fill.html#Output-Section-Fill">Output Section Fill</a>, for details on the fill
expression.
</body></html>