You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
4.8 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
(SiFive Binutils 2.32.0-2020.04.1)
version 2.32.
Copyright (C) 1991-2019 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 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>M68HC11/68HC12 (LD)</title>
<meta name="description" content="M68HC11/68HC12 (LD)">
<meta name="keywords" content="M68HC11/68HC12 (LD)">
<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="ARM.html#ARM" rel="next" title="ARM">
<link href="H8_002f300.html#H8_002f300" rel="prev" title="H8/300">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
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.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="M68HC11_002f68HC12"></a>
<div class="header">
<p>
Next: <a href="ARM.html#ARM" accesskey="n" rel="next">ARM</a>, Previous: <a href="H8_002f300.html#H8_002f300" accesskey="p" rel="prev">H8/300</a>, Up: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="u" rel="up">Machine Dependent</a> &nbsp; [<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-the-Motorola-68HC11-and-68HC12-families"></a>
<h3 class="section">4.2 <code>ld</code> and the Motorola 68HC11 and 68HC12 families</h3>
<a name="index-M68HC11-and-68HC12-support"></a>
<a name="Linker-Relaxation"></a>
<h4 class="subsection">4.2.1 Linker Relaxation</h4>
<p>For the Motorola 68HC11, <code>ld</code> can perform these global
optimizations when you specify the &lsquo;<samp>--relax</samp>&rsquo; command-line option.
</p>
<dl compact="compact">
<dd><a name="index-relaxing-on-M68HC11"></a>
</dd>
<dt><em>relaxing address modes</em></dt>
<dd><p><code>ld</code> finds all <code>jsr</code> and <code>jmp</code> instructions whose
targets are within eight bits, and turns them into eight-bit
program-counter relative <code>bsr</code> and <code>bra</code> instructions,
respectively.
</p>
<p><code>ld</code> also looks at all 16-bit extended addressing modes and
transforms them in a direct addressing mode when the address is in
page 0 (between 0 and 0x0ff).
</p>
</dd>
<dt><em>relaxing gcc instruction group</em></dt>
<dd><p>When <code>gcc</code> is called with <samp>-mrelax</samp>, it can emit group
of instructions that the linker can optimize to use a 68HC11 direct
addressing mode. These instructions consists of <code>bclr</code> or
<code>bset</code> instructions.
</p>
</dd>
</dl>
<a name="Trampoline-Generation"></a>
<h4 class="subsection">4.2.2 Trampoline Generation</h4>
<a name="index-trampoline-generation-on-M68HC11"></a>
<a name="index-trampoline-generation-on-M68HC12"></a>
<p>For 68HC11 and 68HC12, <code>ld</code> can generate trampoline code to
call a far function using a normal <code>jsr</code> instruction. The linker
will also change the relocation to some far function to use the
trampoline address instead of the function address. This is typically the
case when a pointer to a function is taken. The pointer will in fact
point to the function trampoline.
</p>
</body>
</html>