150 lines
6.7 KiB
HTML
150 lines
6.7 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- This file documents the GNU linker LD
|
|
(Linaro_Binutils-2017.02)
|
|
version 2.27.0.
|
|
|
|
Copyright (C) 1991-2016 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.3
|
|
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". -->
|
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<title>LD: Xtensa</title>
|
|
|
|
<meta name="description" content="LD: Xtensa">
|
|
<meta name="keywords" content="LD: Xtensa">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<link href="index.html#Top" rel="start" title="Top">
|
|
<link href="LD-Index.html#LD-Index" rel="index" title="LD Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="Machine-Dependent.html#Machine-Dependent" rel="up" title="Machine Dependent">
|
|
<link href="BFD.html#BFD" rel="next" title="BFD">
|
|
<link href="WIN32.html#WIN32" rel="prev" title="WIN32">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.smallquotation {font-size: smaller}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.indentedblock {margin-left: 3.2em}
|
|
div.lisp {margin-left: 3.2em}
|
|
div.smalldisplay {margin-left: 3.2em}
|
|
div.smallexample {margin-left: 3.2em}
|
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
|
div.smalllisp {margin-left: 3.2em}
|
|
kbd {font-style:oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
|
pre.smallexample {font-size: smaller}
|
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
|
pre.smalllisp {font-size: smaller}
|
|
span.nocodebreak {white-space:nowrap}
|
|
span.nolinebreak {white-space:nowrap}
|
|
span.roman {font-family:serif; font-weight:normal}
|
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
|
<a name="Xtensa"></a>
|
|
<div class="header">
|
|
<p>
|
|
Previous: <a href="WIN32.html#WIN32" accesskey="p" rel="prev">WIN32</a>, Up: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="u" rel="up">Machine Dependent</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<a name="ld-and-Xtensa-Processors"></a>
|
|
<h3 class="section">4.17 <code>ld</code> and Xtensa Processors</h3>
|
|
|
|
<a name="index-Xtensa-processors"></a>
|
|
<p>The default <code>ld</code> behavior for Xtensa processors is to interpret
|
|
<code>SECTIONS</code> commands so that lists of explicitly named sections in a
|
|
specification with a wildcard file will be interleaved when necessary to
|
|
keep literal pools within the range of PC-relative load offsets. For
|
|
example, with the command:
|
|
</p>
|
|
<div class="smallexample">
|
|
<pre class="smallexample">SECTIONS
|
|
{
|
|
.text : {
|
|
*(.literal .text)
|
|
}
|
|
}
|
|
</pre></div>
|
|
|
|
<p><code>ld</code> may interleave some of the <code>.literal</code>
|
|
and <code>.text</code> sections from different object files to ensure that the
|
|
literal pools are within the range of PC-relative load offsets. A valid
|
|
interleaving might place the <code>.literal</code> sections from an initial
|
|
group of files followed by the <code>.text</code> sections of that group of
|
|
files. Then, the <code>.literal</code> sections from the rest of the files
|
|
and the <code>.text</code> sections from the rest of the files would follow.
|
|
</p>
|
|
<a name="index-_002d_002drelax-on-Xtensa"></a>
|
|
<a name="index-relaxing-on-Xtensa"></a>
|
|
<p>Relaxation is enabled by default for the Xtensa version of <code>ld</code> and
|
|
provides two important link-time optimizations. The first optimization
|
|
is to combine identical literal values to reduce code size. A redundant
|
|
literal will be removed and all the <code>L32R</code> instructions that use it
|
|
will be changed to reference an identical literal, as long as the
|
|
location of the replacement literal is within the offset range of all
|
|
the <code>L32R</code> instructions. The second optimization is to remove
|
|
unnecessary overhead from assembler-generated “longcall” sequences of
|
|
<code>L32R</code>/<code>CALLX<var>n</var></code> when the target functions are within
|
|
range of direct <code>CALL<var>n</var></code> instructions.
|
|
</p>
|
|
<p>For each of these cases where an indirect call sequence can be optimized
|
|
to a direct call, the linker will change the <code>CALLX<var>n</var></code>
|
|
instruction to a <code>CALL<var>n</var></code> instruction, remove the <code>L32R</code>
|
|
instruction, and remove the literal referenced by the <code>L32R</code>
|
|
instruction if it is not used for anything else. Removing the
|
|
<code>L32R</code> instruction always reduces code size but can potentially
|
|
hurt performance by changing the alignment of subsequent branch targets.
|
|
By default, the linker will always preserve alignments, either by
|
|
switching some instructions between 24-bit encodings and the equivalent
|
|
density instructions or by inserting a no-op in place of the <code>L32R</code>
|
|
instruction that was removed. If code size is more important than
|
|
performance, the <samp>--size-opt</samp> option can be used to prevent the
|
|
linker from widening density instructions or inserting no-ops, except in
|
|
a few cases where no-ops are required for correctness.
|
|
</p>
|
|
<p>The following Xtensa-specific command-line options can be used to
|
|
control the linker:
|
|
</p>
|
|
<a name="index-Xtensa-options"></a>
|
|
<dl compact="compact">
|
|
<dt><samp>--size-opt</samp></dt>
|
|
<dd><p>When optimizing indirect calls to direct calls, optimize for code size
|
|
more than performance. With this option, the linker will not insert
|
|
no-ops or widen density instructions to preserve branch target
|
|
alignment. There may still be some cases where no-ops are required to
|
|
preserve the correctness of the code.
|
|
</p></dd>
|
|
</dl>
|
|
|
|
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Previous: <a href="WIN32.html#WIN32" accesskey="p" rel="prev">WIN32</a>, Up: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="u" rel="up">Machine Dependent</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|