?? provide.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="PROVIDE">PROVIDE</a>,
Previous:<a rel="previous" accesskey="p" href="Simple-Assignments.html#Simple%20Assignments">Simple Assignments</a>,
Up:<a rel="up" accesskey="u" href="Assignments.html#Assignments">Assignments</a>
<hr><br>
</div>
<h4 class="subsection">PROVIDE</h4>
<p>In some cases, it is desirable for a linker script to define a symbol
only if it is referenced and is not defined by any object included in
the link. For example, traditional linkers defined the symbol
<code>etext</code>. However, ANSI C requires that the user be able to use
<code>etext</code> as a function name without encountering an error. The
<code>PROVIDE</code> keyword may be used to define a symbol, such as
<code>etext</code>, only if it is referenced but not defined. The syntax is
<code>PROVIDE(</code><var>symbol</var><code> = </code><var>expression</var><code>)</code>.
<p>Here is an example of using <code>PROVIDE</code> to define <code>etext</code>:
<pre class="smallexample"> SECTIONS
{
.text :
{
*(.text)
_etext = .;
PROVIDE(etext = .);
}
}
</pre>
<p>In this example, if the program defines <code>_etext</code> (with a leading
underscore), the linker will give a multiple definition error. If, on
the other hand, the program defines <code>etext</code> (with no leading
underscore), the linker will silently use the definition in the program.
If the program references <code>etext</code> but does not define it, the
linker will use the definition in the linker script.
</body></html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -