miscellaneous-commands.html

来自「gcc手册」· HTML 代码 · 共 69 行

HTML
69
字号
<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="Miscellaneous%20Commands">Miscellaneous Commands</a>,

Previous:<a rel="previous" accesskey="p" href="Format-Commands.html#Format%20Commands">Format Commands</a>,

Up:<a rel="up" accesskey="u" href="Simple-Commands.html#Simple%20Commands">Simple Commands</a>

<hr><br>

</div>



<h4 class="subsection">Other linker script commands</h4>



   <p>There are a few other linker scripts commands.



     <dl>

<dt><code>ASSERT(</code><var>exp</var><code>, </code><var>message</var><code>)</code>

     <dd>Ensure that <var>exp</var> is non-zero.  If it is zero, then exit the linker

with an error code, and print <var>message</var>.



     <br><dt><code>EXTERN(</code><var>symbol</var><code> </code><var>symbol</var><code> ...)</code>

     <dd>Force <var>symbol</var> to be entered in the output file as an undefined

symbol.  Doing this may, for example, trigger linking of additional

modules from standard libraries.  You may list several <var>symbol</var>s for

each <code>EXTERN</code>, and you may use <code>EXTERN</code> multiple times.  This

command has the same effect as the <code>-u</code> command-line option.



     <br><dt><code>FORCE_COMMON_ALLOCATION</code>

     <dd>This command has the same effect as the <code>-d</code> command-line option:

to make <code>ld</code> assign space to common symbols even if a relocatable

output file is specified (<code>-r</code>).



     <br><dt><code>INHIBIT_COMMON_ALLOCATION</code>

     <dd>This command has the same effect as the <code>--no-define-common</code>

command-line option: to make <code>ld</code> omit the assignment of addresses

to common symbols even for a non-relocatable output file.



     <br><dt><code>NOCROSSREFS(</code><var>section</var><code> </code><var>section</var><code> ...)</code>

     <dd>This command may be used to tell <code>ld</code> to issue an error about any

references among certain output sections.



     <p>In certain types of programs, particularly on embedded systems when

using overlays, when one section is loaded into memory, another section

will not be.  Any direct references between the two sections would be

errors.  For example, it would be an error if code in one section called

a function defined in the other section.



     <p>The <code>NOCROSSREFS</code> command takes a list of output section names.  If

<code>ld</code> detects any cross references between the sections, it reports

an error and returns a non-zero exit status.  Note that the

<code>NOCROSSREFS</code> command uses output section names, not input section

names.



     <br><dt><code>OUTPUT_ARCH(</code><var>bfdarch</var><code>)</code>

     <dd>Specify a particular output machine architecture.  The argument is one

of the names used by the BFD library (see <a href="BFD.html#BFD">BFD</a>).  You can see the

architecture of an object file by using the <code>objdump</code> program with

the <code>-f</code> option. 

</dl>



   </body></html>



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?