<html lang="en"> <head> <title>M68HC11/68HC12 - Untitled</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Untitled"> <meta name="generator" content="makeinfo 4.7"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Machine-Dependent.html#Machine-Dependent" title="Machine Dependent"> <link rel="prev" href="MSP430.html#MSP430" title="MSP430"> <link rel="next" href="PowerPC-ELF32.html#PowerPC-ELF32" title="PowerPC ELF32"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This file documents the GNU linker LD (GNU Binutils) version 2.19. Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 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.1 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''.--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family: serif; font-weight: normal; } --></style> </head> <body> <div class="node"> <p> <a name="M68HC11_002f68HC12"></a>Next: <a rel="next" accesskey="n" href="PowerPC-ELF32.html#PowerPC-ELF32">PowerPC ELF32</a>, Previous: <a rel="previous" accesskey="p" href="MSP430.html#MSP430">MSP430</a>, Up: <a rel="up" accesskey="u" href="Machine-Dependent.html#Machine-Dependent">Machine Dependent</a> <hr><br> </div> <h3 class="section">4.3 <span class="command">ld</span> and the Motorola 68HC11 and 68HC12 families</h3> <p><a name="index-M68HC11-and-68HC12-support-528"></a> <h4 class="subsection">4.3.1 Linker Relaxation</h4> <p>For the Motorola 68HC11, <span class="command">ld</span> can perform these global optimizations when you specify the <span class="samp">--relax</span> command-line option. <a name="index-relaxing-on-M68HC11-529"></a> <dl><dt><em>relaxing address modes</em><dd><span class="command">ld</span> 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><span class="command">ld</span> 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). <br><dt><em>relaxing gcc instruction group</em><dd>When <span class="command">gcc</span> is called with <span class="option">-mrelax</span>, 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. </dl> <h4 class="subsection">4.3.2 Trampoline Generation</h4> <p><a name="index-trampoline-generation-on-M68HC11-530"></a><a name="index-trampoline-generation-on-M68HC12-531"></a>For 68HC11 and 68HC12, <span class="command">ld</span> 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. </body></html>