blob: 887c84c2401f042749d640b244b214cfcb810ddd [file] [log] [blame] [edit]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This file documents the GNU linker LD
(Linaro GDB 2015.08)
version 2.25.51.
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". -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>LD: PowerPC ELF32</title>
<meta name="description" content="LD: PowerPC ELF32">
<meta name="keywords" content="LD: PowerPC ELF32">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="LD-Index.html#LD-Index" rel="index" title="LD Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Machine-Dependent.html#Machine-Dependent" rel="up" title="Machine Dependent">
<link href="PowerPC64-ELF64.html#PowerPC64-ELF64" rel="next" title="PowerPC64 ELF64">
<link href="Nios-II.html#Nios-II" rel="prev" title="Nios II">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="PowerPC-ELF32"></a>
<div class="header">
<p>
Next: <a href="PowerPC64-ELF64.html#PowerPC64-ELF64" accesskey="n" rel="next">PowerPC64 ELF64</a>, Previous: <a href="Nios-II.html#Nios-II" accesskey="p" rel="prev">Nios II</a>, Up: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="u" rel="up">Machine Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="ld-and-PowerPC-32_002dbit-ELF-Support"></a>
<h3 class="section">4.12 <code>ld</code> and PowerPC 32-bit ELF Support</h3>
<a name="index-PowerPC-long-branches"></a>
<a name="index-_002d_002drelax-on-PowerPC"></a>
<p>Branches on PowerPC processors are limited to a signed 26-bit
displacement, which may result in <code>ld</code> giving
&lsquo;<samp>relocation truncated to fit</samp>&rsquo; errors with very large programs.
&lsquo;<samp>--relax</samp>&rsquo; 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. You may combine &lsquo;<samp>-r</samp>&rsquo; and
&lsquo;<samp>--relax</samp>&rsquo; to add trampolines in a partial link. In that case
both branches to undefined symbols and inter-section branches are also
considered potentially out of range, and trampolines inserted.
</p>
<a name="index-PowerPC-ELF32-options"></a>
<dl compact="compact">
<dd><a name="index-PowerPC-PLT"></a>
<a name="index-_002d_002dbss_002dplt"></a>
</dd>
<dt><samp>--bss-plt</samp></dt>
<dd><p>Current PowerPC GCC accepts a &lsquo;<samp>-msecure-plt</samp>&rsquo; 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
<code>ld</code> will generate this layout, including stubs to access the
PLT, if all input files (including startup and static libraries) were
compiled with &lsquo;<samp>-msecure-plt</samp>&rsquo;. &lsquo;<samp>--bss-plt</samp>&rsquo; forces the old
BSS PLT (and GOT layout) which can give slightly better performance.
</p>
<a name="index-_002d_002dsecure_002dplt"></a>
</dd>
<dt><samp>--secure-plt</samp></dt>
<dd><p><code>ld</code> will use the new PLT and GOT layout if it is linking new
&lsquo;<samp>-fpic</samp>&rsquo; or &lsquo;<samp>-fPIC</samp>&rsquo; code, but does not do so automatically
when linking non-PIC code. This option requests the new PLT and GOT
layout. A warning will be given if some object file requires the old
style BSS PLT.
</p>
<a name="index-PowerPC-GOT"></a>
<a name="index-_002d_002dsdata_002dgot"></a>
</dd>
<dt><samp>--sdata-got</samp></dt>
<dd><p>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
&lsquo;<samp>-z relro -z now</samp>&rsquo;. 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. &lsquo;<samp>--sdata-got</samp>&rsquo; forces the old GOT placement. PowerPC
GCC doesn&rsquo;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"></a>
<a name="index-_002d_002demit_002dstub_002dsyms"></a>
</dd>
<dt><samp>--emit-stub-syms</samp></dt>
<dd><p>This option causes <code>ld</code> to label linker stubs with a local
symbol that encodes the stub type and destination.
</p>
<a name="index-PowerPC-TLS-optimization"></a>
<a name="index-_002d_002dno_002dtls_002doptimize"></a>
</dd>
<dt><samp>--no-tls-optimize</samp></dt>
<dd><p>PowerPC <code>ld</code> normally performs some optimization of code
sequences used to access Thread-Local Storage. Use this option to
disable the optimization.
</p></dd>
</dl>
<hr>
<div class="header">
<p>
Next: <a href="PowerPC64-ELF64.html#PowerPC64-ELF64" accesskey="n" rel="next">PowerPC64 ELF64</a>, Previous: <a href="Nios-II.html#Nios-II" accesskey="p" rel="prev">Nios II</a>, Up: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="u" rel="up">Machine Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>