<html lang="en">
<head>
<title>PowerPC ELF32 - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.8">
<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="PowerPC64-ELF64.html#PowerPC64-ELF64" title="PowerPC64 ELF64">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
@import url("../raisonance.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">
<p>
<a name="PowerPC-ELF32"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="PowerPC64-ELF64.html#PowerPC64-ELF64">PowerPC64 ELF64</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="MSP430.html#MSP430">MSP430</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Machine-Dependent.html#Machine-Dependent">Machine Dependent</a>
<hr>
</div>

<h3 class="section">4.7 <samp><span class="command">ld</span></samp> and PowerPC 32-bit ELF Support</h3>

<p><a name="index-PowerPC-long-branches-534"></a><a name="index-g_t_002d_002drelax-on-PowerPC-535"></a>Branches on PowerPC processors are limited to a signed 26-bit
displacement, 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. 
`<samp><span class="samp">--relax</span></samp>' enables the generation of trampolines that can access
the entire 32-bit address space.  These trampolines are inserted at
section boundaries, so may not themselves be reachable if an input
section exceeds 33M in size.

   <p><a name="index-PowerPC-ELF32-options-536"></a>
     
<a name="index-PowerPC-PLT-537"></a>
<a name="index-g_t_002d_002dbss_002dplt-538"></a>
<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
generates code capable of using a newer PLT and GOT layout that has
the security advantage of no executable section ever needing to be
writable and no writable section ever being executable.  PowerPC
<samp><span class="command">ld</span></samp> will generate this layout, including stubs to access the
PLT, if all input files (including startup and static libraries) were
compiled with `<samp><span class="samp">-msecure-plt</span></samp>'.  `<samp><span class="samp">--bss-plt</span></samp>' forces the old
BSS PLT (and GOT layout) which can give slightly better performance.

     <p><a name="index-PowerPC-GOT-539"></a><a name="index-g_t_002d_002dsdata_002dgot-540"></a><br><dt><samp><span class="option">--sdata-got</span></samp><dd>The new secure PLT and GOT are placed differently relative to other
sections compared to older BSS PLT and GOT placement.  The location of
<code>.plt</code> must change because the new secure PLT is an initialized
section while the old PLT is uninitialized.  The reason for the
<code>.got</code> change is more subtle:  The new placement allows
<code>.got</code> to be read-only in applications linked with
`<samp><span class="samp">-z relro -z now</span></samp>'.  However, this placement means that
<code>.sdata</code> cannot always be used in shared libraries, because the
PowerPC ABI accesses <code>.sdata</code> in shared libraries from the GOT
pointer.  `<samp><span class="samp">--sdata-got</span></samp>' forces the old GOT placement.  PowerPC
GCC doesn't use <code>.sdata</code> in shared libraries, so this option is
really only useful for other compilers that may do so.

     <p><a name="index-PowerPC-stub-symbols-541"></a><a name="index-g_t_002d_002demit_002dstub_002dsyms-542"></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
symbol that encodes the stub type and destination.

     <p><a name="index-PowerPC-TLS-optimization-543"></a><a name="index-g_t_002d_002dno_002dtls_002doptimize-544"></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
sequences used to access Thread-Local Storage.  Use this option to
disable the optimization. 
</dl>

   </body></html>

