1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- This file documents the GNU linker LD
4(GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29))
5version 2.36.1.
6
7Copyright (C) 1991-2021 Free Software Foundation, Inc.
8
9Permission is granted to copy, distribute and/or modify this document
10under the terms of the GNU Free Documentation License, Version 1.3
11or any later version published by the Free Software Foundation;
12with no Invariant Sections, with no Front-Cover Texts, and with no
13Back-Cover Texts.  A copy of the license is included in the
14section entitled "GNU Free Documentation License". -->
15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
16<head>
17<title>LD: PowerPC ELF32</title>
18
19<meta name="description" content="LD: PowerPC ELF32">
20<meta name="keywords" content="LD: PowerPC ELF32">
21<meta name="resource-type" content="document">
22<meta name="distribution" content="global">
23<meta name="Generator" content="makeinfo">
24<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
25<link href="index.html#Top" rel="start" title="Top">
26<link href="LD-Index.html#LD-Index" rel="index" title="LD Index">
27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
28<link href="Machine-Dependent.html#Machine-Dependent" rel="up" title="Machine Dependent">
29<link href="PowerPC64-ELF64.html#PowerPC64-ELF64" rel="next" title="PowerPC64 ELF64">
30<link href="Nios-II.html#Nios-II" rel="previous" title="Nios II">
31<style type="text/css">
32<!--
33a.summary-letter {text-decoration: none}
34blockquote.smallquotation {font-size: smaller}
35div.display {margin-left: 3.2em}
36div.example {margin-left: 3.2em}
37div.indentedblock {margin-left: 3.2em}
38div.lisp {margin-left: 3.2em}
39div.smalldisplay {margin-left: 3.2em}
40div.smallexample {margin-left: 3.2em}
41div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
42div.smalllisp {margin-left: 3.2em}
43kbd {font-style:oblique}
44pre.display {font-family: inherit}
45pre.format {font-family: inherit}
46pre.menu-comment {font-family: serif}
47pre.menu-preformatted {font-family: serif}
48pre.smalldisplay {font-family: inherit; font-size: smaller}
49pre.smallexample {font-size: smaller}
50pre.smallformat {font-family: inherit; font-size: smaller}
51pre.smalllisp {font-size: smaller}
52span.nocodebreak {white-space:nowrap}
53span.nolinebreak {white-space:nowrap}
54span.roman {font-family:serif; font-weight:normal}
55span.sansserif {font-family:sans-serif; font-weight:normal}
56ul.no-bullet {list-style: none}
57-->
58</style>
59
60
61</head>
62
63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
64<a name="PowerPC-ELF32"></a>
65<div class="header">
66<p>
67Next: <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="previous">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>
68</div>
69<hr>
70<a name="ld-and-PowerPC-32_002dbit-ELF-Support"></a>
71<h3 class="section">5.11 <code>ld</code> and PowerPC 32-bit ELF Support</h3>
72<a name="index-PowerPC-long-branches"></a>
73<a name="index-_002d_002drelax-on-PowerPC"></a>
74<p>Branches on PowerPC processors are limited to a signed 26-bit
75displacement, which may result in <code>ld</code> giving
76&lsquo;<samp>relocation truncated to fit</samp>&rsquo; errors with very large programs.
77&lsquo;<samp>--relax</samp>&rsquo; enables the generation of trampolines that can access
78the entire 32-bit address space.  These trampolines are inserted at
79section boundaries, so may not themselves be reachable if an input
80section exceeds 33M in size.  You may combine &lsquo;<samp>-r</samp>&rsquo; and
81&lsquo;<samp>--relax</samp>&rsquo; to add trampolines in a partial link.  In that case
82both branches to undefined symbols and inter-section branches are also
83considered potentially out of range, and trampolines inserted.
84</p>
85<a name="index-PowerPC-ELF32-options"></a>
86<dl compact="compact">
87<dd><a name="index-PowerPC-PLT"></a>
88<a name="index-_002d_002dbss_002dplt"></a>
89</dd>
90<dt><samp>--bss-plt</samp></dt>
91<dd><p>Current PowerPC GCC accepts a &lsquo;<samp>-msecure-plt</samp>&rsquo; option that
92generates code capable of using a newer PLT and GOT layout that has
93the security advantage of no executable section ever needing to be
94writable and no writable section ever being executable.  PowerPC
95<code>ld</code> will generate this layout, including stubs to access the
96PLT, if all input files (including startup and static libraries) were
97compiled with &lsquo;<samp>-msecure-plt</samp>&rsquo;.  &lsquo;<samp>--bss-plt</samp>&rsquo; forces the old
98BSS PLT (and GOT layout) which can give slightly better performance.
99</p>
100<a name="index-_002d_002dsecure_002dplt"></a>
101</dd>
102<dt><samp>--secure-plt</samp></dt>
103<dd><p><code>ld</code> will use the new PLT and GOT layout if it is linking new
104&lsquo;<samp>-fpic</samp>&rsquo; or &lsquo;<samp>-fPIC</samp>&rsquo; code, but does not do so automatically
105when linking non-PIC code.  This option requests the new PLT and GOT
106layout.  A warning will be given if some object file requires the old
107style BSS PLT.
108</p>
109<a name="index-PowerPC-GOT"></a>
110<a name="index-_002d_002dsdata_002dgot"></a>
111</dd>
112<dt><samp>--sdata-got</samp></dt>
113<dd><p>The new secure PLT and GOT are placed differently relative to other
114sections compared to older BSS PLT and GOT placement.  The location of
115<code>.plt</code> must change because the new secure PLT is an initialized
116section while the old PLT is uninitialized.  The reason for the
117<code>.got</code> change is more subtle:  The new placement allows
118<code>.got</code> to be read-only in applications linked with
119&lsquo;<samp>-z relro -z now</samp>&rsquo;.  However, this placement means that
120<code>.sdata</code> cannot always be used in shared libraries, because the
121PowerPC ABI accesses <code>.sdata</code> in shared libraries from the GOT
122pointer.  &lsquo;<samp>--sdata-got</samp>&rsquo; forces the old GOT placement.  PowerPC
123GCC doesn&rsquo;t use <code>.sdata</code> in shared libraries, so this option is
124really only useful for other compilers that may do so.
125</p>
126<a name="index-PowerPC-stub-symbols"></a>
127<a name="index-_002d_002demit_002dstub_002dsyms"></a>
128</dd>
129<dt><samp>--emit-stub-syms</samp></dt>
130<dd><p>This option causes <code>ld</code> to label linker stubs with a local
131symbol that encodes the stub type and destination.
132</p>
133<a name="index-PowerPC-TLS-optimization"></a>
134<a name="index-_002d_002dno_002dtls_002doptimize"></a>
135</dd>
136<dt><samp>--no-tls-optimize</samp></dt>
137<dd><p>PowerPC <code>ld</code> normally performs some optimization of code
138sequences used to access Thread-Local Storage.  Use this option to
139disable the optimization.
140</p></dd>
141</dl>
142
143
144
145<hr>
146<div class="header">
147<p>
148Next: <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="previous">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>
149</div>
150
151
152
153</body>
154</html>
155