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.
88 lines
4.0 KiB
HTML
88 lines
4.0 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Output Section Address - 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="Output-Section-Name.html#Output-Section-Name" title="Output Section Name">
|
|
<link rel="next" href="Input-Section.html#Input-Section" title="Input Section">
|
|
<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-Address"></a>Next: <a rel="next" accesskey="n" href="Input-Section.html#Input-Section">Input Section</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="Output-Section-Name.html#Output-Section-Name">Output Section Name</a>,
|
|
Up: <a rel="up" accesskey="u" href="SECTIONS.html#SECTIONS">SECTIONS</a>
|
|
<hr><br>
|
|
</div>
|
|
|
|
<h4 class="subsection">3.6.3 Output Section Address</h4>
|
|
|
|
<p><a name="index-address_002c-section-364"></a><a name="index-section-address-365"></a>The <var>address</var> is an expression for the VMA (the virtual memory
|
|
address) of the output section. If you do not provide <var>address</var>,
|
|
the linker will set it based on <var>region</var> if present, or otherwise
|
|
based on the current value of the location counter.
|
|
|
|
<p>If you provide <var>address</var>, the address of the output section will be
|
|
set to precisely that. If you provide neither <var>address</var> nor
|
|
<var>region</var>, then the address of the output section will be set to the
|
|
current value of the location counter aligned to the alignment
|
|
requirements of the output section. The alignment requirement of the
|
|
output section is the strictest alignment of any input section contained
|
|
within the output section.
|
|
|
|
<p>For example,
|
|
<pre class="smallexample"> .text . : { *(.text) }
|
|
</pre>
|
|
<p class="noindent">and
|
|
<pre class="smallexample"> .text : { *(.text) }
|
|
</pre>
|
|
<p class="noindent">are subtly different. The first will set the address of the
|
|
<span class="samp">.text</span> output section to the current value of the location
|
|
counter. The second will set it to the current value of the location
|
|
counter aligned to the strictest alignment of a <span class="samp">.text</span> input
|
|
section.
|
|
|
|
<p>The <var>address</var> may be an arbitrary expression; <a href="Expressions.html#Expressions">Expressions</a>.
|
|
For example, if you want to align the section on a 0x10 byte boundary,
|
|
so that the lowest four bits of the section address are zero, you could
|
|
do something like this:
|
|
<pre class="smallexample"> .text ALIGN(0x10) : { *(.text) }
|
|
</pre>
|
|
<p class="noindent">This works because <code>ALIGN</code> returns the current location counter
|
|
aligned upward to the specified value.
|
|
|
|
<p>Specifying <var>address</var> for a section will change the value of the
|
|
location counter.
|
|
|
|
</body></html>
|
|
|