📄 expression-section.html
字号:
<html lang="en">
<head>
<title>Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
</head>
<body>
<div class="node">
<p>
Node:<a name="Expression%20Section">Expression Section</a>,
Next:<a rel="next" accesskey="n" href="Builtin-Functions.html#Builtin%20Functions">Builtin Functions</a>,
Previous:<a rel="previous" accesskey="p" href="Evaluation.html#Evaluation">Evaluation</a>,
Up:<a rel="up" accesskey="u" href="Expressions.html#Expressions">Expressions</a>
<hr><br>
</div>
<h4 class="subsection">The Section of an Expression</h4>
<p>When the linker evaluates an expression, the result is either absolute
or relative to some section. A relative expression is expressed as a
fixed offset from the base of a section.
<p>The position of the expression within the linker script determines
whether it is absolute or relative. An expression which appears within
an output section definition is relative to the base of the output
section. An expression which appears elsewhere will be absolute.
<p>A symbol set to a relative expression will be relocatable if you request
relocatable output using the <code>-r</code> option. That means that a
further link operation may change the value of the symbol. The symbol's
section will be the section of the relative expression.
<p>A symbol set to an absolute expression will retain the same value
through any further link operation. The symbol will be absolute, and
will not have any particular associated section.
<p>You can use the builtin function <code>ABSOLUTE</code> to force an expression
to be absolute when it would otherwise be relative. For example, to
create an absolute symbol set to the address of the end of the output
section <code>.data</code>:
<pre class="smallexample"> SECTIONS
{
.data : { *(.data) _edata = ABSOLUTE(.); }
}
</pre>
<p>If <code>ABSOLUTE</code> were not used, <code>_edata</code> would be relative to the
<code>.data</code> section.
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -