PowerPC-ELF32.html 7.3 KB

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