1<html lang="en"> 2<head> 3<title>M68HC11/68HC12 - 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="Machine-Dependent.html#Machine-Dependent" title="Machine Dependent"> 9<link rel="prev" href="MSP430.html#MSP430" title="MSP430"> 10<link rel="next" href="PowerPC-ELF32.html#PowerPC-ELF32" title="PowerPC ELF32"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13This file documents the GNU linker LD 14(Sourcery CodeBench Lite 2011.09-69) 15version 2.21.53. 16 17Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 182001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 19 20Permission is granted to copy, distribute and/or modify this document 21under the terms of the GNU Free Documentation License, Version 1.3 22or any later version published by the Free Software Foundation; 23with no Invariant Sections, with no Front-Cover Texts, and with no 24Back-Cover Texts. A copy of the license is included in the 25section entitled ``GNU Free Documentation License''.--> 26<meta http-equiv="Content-Style-Type" content="text/css"> 27<style type="text/css"><!-- 28 pre.display { font-family:inherit } 29 pre.format { font-family:inherit } 30 pre.smalldisplay { font-family:inherit; font-size:smaller } 31 pre.smallformat { font-family:inherit; font-size:smaller } 32 pre.smallexample { font-size:smaller } 33 pre.smalllisp { font-size:smaller } 34 span.sc { font-variant:small-caps } 35 span.roman { font-family:serif; font-weight:normal; } 36 span.sansserif { font-family:sans-serif; font-weight:normal; } 37--></style> 38<link rel="stylesheet" type="text/css" href="../cs.css"> 39</head> 40<body> 41<div class="node"> 42<a name="M68HC11%2f68HC12"></a> 43<a name="M68HC11_002f68HC12"></a> 44<p> 45Next: <a rel="next" accesskey="n" href="PowerPC-ELF32.html#PowerPC-ELF32">PowerPC ELF32</a>, 46Previous: <a rel="previous" accesskey="p" href="MSP430.html#MSP430">MSP430</a>, 47Up: <a rel="up" accesskey="u" href="Machine-Dependent.html#Machine-Dependent">Machine Dependent</a> 48<hr> 49</div> 50 51<h3 class="section">4.3 <samp><span class="command">ld</span></samp> and the Motorola 68HC11 and 68HC12 families</h3> 52 53<p><a name="index-M68HC11-and-68HC12-support-580"></a> 54 55<h4 class="subsection">4.3.1 Linker Relaxation</h4> 56 57<p>For the Motorola 68HC11, <samp><span class="command">ld</span></samp> can perform these global 58optimizations when you specify the ‘<samp><span class="samp">--relax</span></samp>’ command-line option. 59 60 61<a name="index-relaxing-on-M68HC11-581"></a> 62<dl><dt><em>relaxing address modes</em><dd><samp><span class="command">ld</span></samp> finds all <code>jsr</code> and <code>jmp</code> instructions whose 63targets are within eight bits, and turns them into eight-bit 64program-counter relative <code>bsr</code> and <code>bra</code> instructions, 65respectively. 66 67 <p><samp><span class="command">ld</span></samp> also looks at all 16-bit extended addressing modes and 68transforms them in a direct addressing mode when the address is in 69page 0 (between 0 and 0x0ff). 70 71 <br><dt><em>relaxing gcc instruction group</em><dd>When <samp><span class="command">gcc</span></samp> is called with <samp><span class="option">-mrelax</span></samp>, it can emit group 72of instructions that the linker can optimize to use a 68HC11 direct 73addressing mode. These instructions consists of <code>bclr</code> or 74<code>bset</code> instructions. 75 76 </dl> 77 78<h4 class="subsection">4.3.2 Trampoline Generation</h4> 79 80<p><a name="index-trampoline-generation-on-M68HC11-582"></a><a name="index-trampoline-generation-on-M68HC12-583"></a>For 68HC11 and 68HC12, <samp><span class="command">ld</span></samp> can generate trampoline code to 81call a far function using a normal <code>jsr</code> instruction. The linker 82will also change the relocation to some far function to use the 83trampoline address instead of the function address. This is typically the 84case when a pointer to a function is taken. The pointer will in fact 85point to the function trampoline. 86 87 </body></html> 88 89