<html lang="en"> <head> <title>Nios II - Untitled</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Untitled"> <meta name="generator" content="makeinfo 4.13"> <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="NDS32.html#NDS32" title="NDS32"> <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.26. Copyright (C) 1991-2015 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''.--> <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; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Nios-II"></a> <p> Next: <a rel="next" accesskey="n" href="PowerPC-ELF32.html#PowerPC-ELF32">PowerPC ELF32</a>, Previous: <a rel="previous" accesskey="p" href="NDS32.html#NDS32">NDS32</a>, Up: <a rel="up" accesskey="u" href="Machine-Dependent.html#Machine-Dependent">Machine Dependent</a> <hr> </div> <h3 class="section">4.11 <samp><span class="command">ld</span></samp> and the Altera Nios II</h3> <p><a name="index-Nios-II-call-relaxation-661"></a><a name="index-g_t_002d_002drelax-on-Nios-II-662"></a> Call and immediate jump instructions on Nios II processors are limited to transferring control to addresses in the same 256MB memory segment, which may result in <samp><span class="command">ld</span></samp> giving ‘<samp><span class="samp">relocation truncated to fit</span></samp>’ errors with very large programs. The command-line option <samp><span class="option">--relax</span></samp> enables the generation of trampolines that can access the entire 32-bit address space for calls outside the normal <code>call</code> and <code>jmpi</code> address range. These trampolines are inserted at section boundaries, so may not themselves be reachable if an input section and its associated call trampolines are larger than 256MB. <p>The <samp><span class="option">--relax</span></samp> option is enabled by default unless <samp><span class="option">-r</span></samp> is also specified. You can disable trampoline generation by using the <samp><span class="option">--no-relax</span></samp> linker option. You can also disable this optimization locally by using the ‘<samp><span class="samp">set .noat</span></samp>’ directive in assembly-language source files, as the linker-inserted trampolines use the <code>at</code> register as a temporary. <p>Note that the linker <samp><span class="option">--relax</span></samp> option is independent of assembler relaxation options, and that using the GNU assembler's <samp><span class="option">-relax-all</span></samp> option interferes with the linker's more selective call instruction relaxation. </body></html>