• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/share/doc/arm-arm-none-eabi/html/ld.html/
1<html lang="en">
2<head>
3<title>Miscellaneous Commands - Untitled</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Untitled">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Simple-Commands.html#Simple-Commands" title="Simple Commands">
9<link rel="prev" href="REGION_005fALIAS.html#REGION_005fALIAS" title="REGION_ALIAS">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12This file documents the GNU linker LD
13(Sourcery CodeBench Lite 2011.09-69)
14version 2.21.53.
15
16Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
172001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
18
19Permission is granted to copy, distribute and/or modify this document
20under the terms of the GNU Free Documentation License, Version 1.3
21or any later version published by the Free Software Foundation;
22with no Invariant Sections, with no Front-Cover Texts, and with no
23Back-Cover Texts.  A copy of the license is included in the
24section entitled ``GNU Free Documentation License''.-->
25<meta http-equiv="Content-Style-Type" content="text/css">
26<style type="text/css"><!--
27  pre.display { font-family:inherit }
28  pre.format  { font-family:inherit }
29  pre.smalldisplay { font-family:inherit; font-size:smaller }
30  pre.smallformat  { font-family:inherit; font-size:smaller }
31  pre.smallexample { font-size:smaller }
32  pre.smalllisp    { font-size:smaller }
33  span.sc    { font-variant:small-caps }
34  span.roman { font-family:serif; font-weight:normal; } 
35  span.sansserif { font-family:sans-serif; font-weight:normal; } 
36--></style>
37<link rel="stylesheet" type="text/css" href="../cs.css">
38</head>
39<body>
40<div class="node">
41<a name="Miscellaneous-Commands"></a>
42<p>
43Previous:&nbsp;<a rel="previous" accesskey="p" href="REGION_005fALIAS.html#REGION_005fALIAS">REGION_ALIAS</a>,
44Up:&nbsp;<a rel="up" accesskey="u" href="Simple-Commands.html#Simple-Commands">Simple Commands</a>
45<hr>
46</div>
47
48<h4 class="subsection">3.4.5 Other Linker Script Commands</h4>
49
50<p>There are a few other linker scripts commands.
51
52     <dl>
53<dt><code>ASSERT(</code><var>exp</var><code>, </code><var>message</var><code>)</code><dd><a name="index-ASSERT-379"></a><a name="index-assertion-in-linker-script-380"></a>Ensure that <var>exp</var> is non-zero.  If it is zero, then exit the linker
54with an error code, and print <var>message</var>.
55
56     <br><dt><code>EXTERN(</code><var>symbol</var> <var>symbol</var><code> ...)</code><dd><a name="index-EXTERN-381"></a><a name="index-undefined-symbol-in-linker-script-382"></a>Force <var>symbol</var> to be entered in the output file as an undefined
57symbol.  Doing this may, for example, trigger linking of additional
58modules from standard libraries.  You may list several <var>symbol</var>s for
59each <code>EXTERN</code>, and you may use <code>EXTERN</code> multiple times.  This
60command has the same effect as the &lsquo;<samp><span class="samp">-u</span></samp>&rsquo; command-line option.
61
62     <br><dt><code>FORCE_COMMON_ALLOCATION</code><dd><a name="index-FORCE_005fCOMMON_005fALLOCATION-383"></a><a name="index-common-allocation-in-linker-script-384"></a>This command has the same effect as the &lsquo;<samp><span class="samp">-d</span></samp>&rsquo; command-line option:
63to make <samp><span class="command">ld</span></samp> assign space to common symbols even if a relocatable
64output file is specified (&lsquo;<samp><span class="samp">-r</span></samp>&rsquo;).
65
66     <br><dt><code>INHIBIT_COMMON_ALLOCATION</code><dd><a name="index-INHIBIT_005fCOMMON_005fALLOCATION-385"></a><a name="index-common-allocation-in-linker-script-386"></a>This command has the same effect as the &lsquo;<samp><span class="samp">--no-define-common</span></samp>&rsquo;
67command-line option: to make <code>ld</code> omit the assignment of addresses
68to common symbols even for a non-relocatable output file.
69
70     <br><dt><code>INSERT [ AFTER | BEFORE ] </code><var>output_section</var><dd><a name="index-INSERT-387"></a><a name="index-insert-user-script-into-default-script-388"></a>This command is typically used in a script specified by &lsquo;<samp><span class="samp">-T</span></samp>&rsquo; to
71augment the default <code>SECTIONS</code> with, for example, overlays.  It
72inserts all prior linker script statements after (or before)
73<var>output_section</var>, and also causes &lsquo;<samp><span class="samp">-T</span></samp>&rsquo; to not override the
74default linker script.  The exact insertion point is as for orphan
75sections.  See <a href="Location-Counter.html#Location-Counter">Location Counter</a>.  The insertion happens after the
76linker has mapped input sections to output sections.  Prior to the
77insertion, since &lsquo;<samp><span class="samp">-T</span></samp>&rsquo; scripts are parsed before the default
78linker script, statements in the &lsquo;<samp><span class="samp">-T</span></samp>&rsquo; script occur before the
79default linker script statements in the internal linker representation
80of the script.  In particular, input section assignments will be made
81to &lsquo;<samp><span class="samp">-T</span></samp>&rsquo; output sections before those in the default script.  Here
82is an example of how a &lsquo;<samp><span class="samp">-T</span></samp>&rsquo; script using <code>INSERT</code> might look:
83
84     <pre class="smallexample">          SECTIONS
85          {
86            OVERLAY :
87            {
88              .ov1 { ov1*(.text) }
89              .ov2 { ov2*(.text) }
90            }
91          }
92          INSERT AFTER .text;
93</pre>
94     <br><dt><code>NOCROSSREFS(</code><var>section</var> <var>section</var><code> ...)</code><dd><a name="index-NOCROSSREFS_0028_0040var_007bsections_007d_0029-389"></a><a name="index-cross-references-390"></a>This command may be used to tell <samp><span class="command">ld</span></samp> to issue an error about any
95references among certain output sections.
96
97     <p>In certain types of programs, particularly on embedded systems when
98using overlays, when one section is loaded into memory, another section
99will not be.  Any direct references between the two sections would be
100errors.  For example, it would be an error if code in one section called
101a function defined in the other section.
102
103     <p>The <code>NOCROSSREFS</code> command takes a list of output section names.  If
104<samp><span class="command">ld</span></samp> detects any cross references between the sections, it reports
105an error and returns a non-zero exit status.  Note that the
106<code>NOCROSSREFS</code> command uses output section names, not input section
107names.
108
109     <br><dt><code>OUTPUT_ARCH(</code><var>bfdarch</var><code>)</code><dd><a name="index-OUTPUT_005fARCH_0028_0040var_007bbfdarch_007d_0029-391"></a><a name="index-machine-architecture-392"></a><a name="index-architecture-393"></a>Specify a particular output machine architecture.  The argument is one
110of the names used by the BFD library (see <a href="BFD.html#BFD">BFD</a>).  You can see the
111architecture of an object file by using the <code>objdump</code> program with
112the &lsquo;<samp><span class="samp">-f</span></samp>&rsquo; option.
113
114     <br><dt><code>LD_FEATURE(</code><var>string</var><code>)</code><dd><a name="index-LD_005fFEATURE_0028_0040var_007bstring_007d_0029-394"></a>This command may be used to modify <samp><span class="command">ld</span></samp> behavior.  If
115<var>string</var> is <code>"SANE_EXPR"</code> then absolute symbols and numbers
116in a script are simply treated as numbers everywhere. 
117See <a href="Expression-Section.html#Expression-Section">Expression Section</a>. 
118</dl>
119
120   </body></html>
121
122