1<html lang="en"> 2<head> 3<title>PowerPC ELF32 - 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="M68HC11_002f68HC12.html#M68HC11_002f68HC12" title="M68HC11/68HC12"> 10<link rel="next" href="PowerPC64-ELF64.html#PowerPC64-ELF64" title="PowerPC64 ELF64"> 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="PowerPC-ELF32"></a> 43<p> 44Next: <a rel="next" accesskey="n" href="PowerPC64-ELF64.html#PowerPC64-ELF64">PowerPC64 ELF64</a>, 45Previous: <a rel="previous" accesskey="p" href="M68HC11_002f68HC12.html#M68HC11_002f68HC12">M68HC11/68HC12</a>, 46Up: <a rel="up" accesskey="u" href="Machine-Dependent.html#Machine-Dependent">Machine Dependent</a> 47<hr> 48</div> 49 50<h3 class="section">4.10 <samp><span class="command">ld</span></samp> and PowerPC 32-bit ELF Support</h3> 51 52<p><a name="index-PowerPC-long-branches-630"></a><a name="index-g_t_002d_002drelax-on-PowerPC-631"></a>Branches on PowerPC processors are limited to a signed 26-bit 53displacement, which may result in <samp><span class="command">ld</span></samp> giving 54‘<samp><span class="samp">relocation truncated to fit</span></samp>’ errors with very large programs. 55‘<samp><span class="samp">--relax</span></samp>’ enables the generation of trampolines that can access 56the entire 32-bit address space. These trampolines are inserted at 57section boundaries, so may not themselves be reachable if an input 58section exceeds 33M in size. You may combine ‘<samp><span class="samp">-r</span></samp>’ and 59‘<samp><span class="samp">--relax</span></samp>’ to add trampolines in a partial link. In that case 60both branches to undefined symbols and inter-section branches are also 61considered potentially out of range, and trampolines inserted. 62 63 <p><a name="index-PowerPC-ELF32-options-632"></a> 64 65<a name="index-PowerPC-PLT-633"></a> 66<a name="index-g_t_002d_002dbss_002dplt-634"></a> 67<dl><dt><samp><span class="option">--bss-plt</span></samp><dd>Current PowerPC GCC accepts a ‘<samp><span class="samp">-msecure-plt</span></samp>’ option that 68generates code capable of using a newer PLT and GOT layout that has 69the security advantage of no executable section ever needing to be 70writable and no writable section ever being executable. PowerPC 71<samp><span class="command">ld</span></samp> will generate this layout, including stubs to access the 72PLT, if all input files (including startup and static libraries) were 73compiled with ‘<samp><span class="samp">-msecure-plt</span></samp>’. ‘<samp><span class="samp">--bss-plt</span></samp>’ forces the old 74BSS PLT (and GOT layout) which can give slightly better performance. 75 76 <p><a name="index-g_t_002d_002dsecure_002dplt-635"></a><br><dt><samp><span class="option">--secure-plt</span></samp><dd><samp><span class="command">ld</span></samp> will use the new PLT and GOT layout if it is linking new 77‘<samp><span class="samp">-fpic</span></samp>’ or ‘<samp><span class="samp">-fPIC</span></samp>’ code, but does not do so automatically 78when linking non-PIC code. This option requests the new PLT and GOT 79layout. A warning will be given if some object file requires the old 80style BSS PLT. 81 82 <p><a name="index-PowerPC-GOT-636"></a><a name="index-g_t_002d_002dsdata_002dgot-637"></a><br><dt><samp><span class="option">--sdata-got</span></samp><dd>The new secure PLT and GOT are placed differently relative to other 83sections compared to older BSS PLT and GOT placement. The location of 84<code>.plt</code> must change because the new secure PLT is an initialized 85section while the old PLT is uninitialized. The reason for the 86<code>.got</code> change is more subtle: The new placement allows 87<code>.got</code> to be read-only in applications linked with 88‘<samp><span class="samp">-z relro -z now</span></samp>’. However, this placement means that 89<code>.sdata</code> cannot always be used in shared libraries, because the 90PowerPC ABI accesses <code>.sdata</code> in shared libraries from the GOT 91pointer. ‘<samp><span class="samp">--sdata-got</span></samp>’ forces the old GOT placement. PowerPC 92GCC doesn't use <code>.sdata</code> in shared libraries, so this option is 93really only useful for other compilers that may do so. 94 95 <p><a name="index-PowerPC-stub-symbols-638"></a><a name="index-g_t_002d_002demit_002dstub_002dsyms-639"></a><br><dt><samp><span class="option">--emit-stub-syms</span></samp><dd>This option causes <samp><span class="command">ld</span></samp> to label linker stubs with a local 96symbol that encodes the stub type and destination. 97 98 <p><a name="index-PowerPC-TLS-optimization-640"></a><a name="index-g_t_002d_002dno_002dtls_002doptimize-641"></a><br><dt><samp><span class="option">--no-tls-optimize</span></samp><dd>PowerPC <samp><span class="command">ld</span></samp> normally performs some optimization of code 99sequences used to access Thread-Local Storage. Use this option to 100disable the optimization. 101</dl> 102 103 </body></html> 104 105