| <html lang="en"> |
| <head> |
| <title>PowerPC64 ELF64 - Untitled</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Untitled"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <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="PowerPC-ELF32.html#PowerPC-ELF32" title="PowerPC ELF32"> |
| <link rel="next" href="S_002f390-ELF.html#S_002f390-ELF" title="S/390 ELF"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU linker LD |
| (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) |
| version 2.33.1. |
| |
| Copyright (C) 1991-2019 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''.--> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/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"> |
| <a name="PowerPC64-ELF64"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="S_002f390-ELF.html#S_002f390-ELF">S/390 ELF</a>, |
| Previous: <a rel="previous" accesskey="p" href="PowerPC-ELF32.html#PowerPC-ELF32">PowerPC ELF32</a>, |
| Up: <a rel="up" accesskey="u" href="Machine-Dependent.html#Machine-Dependent">Machine Dependent</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">4.12 <samp><span class="command">ld</span></samp> and PowerPC64 64-bit ELF Support</h3> |
| |
| <p><a name="index-PowerPC64-ELF64-options-714"></a> |
| |
| <a name="index-PowerPC64-stub-grouping-715"></a> |
| <a name="index-g_t_002d_002dstub_002dgroup_002dsize-716"></a> |
| <dl><dt><samp><span class="option">--stub-group-size</span></samp><dd>Long branch stubs, PLT call stubs and TOC adjusting stubs are placed |
| by <samp><span class="command">ld</span></samp> in stub sections located between groups of input sections. |
| ‘<samp><span class="samp">--stub-group-size</span></samp>’ specifies the maximum size of a group of input |
| sections handled by one stub section. Since branch offsets are signed, |
| a stub section may serve two groups of input sections, one group before |
| the stub section, and one group after it. However, when using |
| conditional branches that require stubs, it may be better (for branch |
| prediction) that stub sections only serve one group of input sections. |
| A negative value for ‘<samp><span class="samp">N</span></samp>’ chooses this scheme, ensuring that |
| branches to stubs always use a negative offset. Two special values of |
| ‘<samp><span class="samp">N</span></samp>’ are recognized, ‘<samp><span class="samp">1</span></samp>’ and ‘<samp><span class="samp">-1</span></samp>’. These both instruct |
| <samp><span class="command">ld</span></samp> to automatically size input section groups for the branch types |
| detected, with the same behaviour regarding stub placement as other |
| positive or negative values of ‘<samp><span class="samp">N</span></samp>’ respectively. |
| |
| <p>Note that ‘<samp><span class="samp">--stub-group-size</span></samp>’ does not split input sections. A |
| single input section larger than the group size specified will of course |
| create a larger group (of one section). If input sections are too |
| large, it may not be possible for a branch to reach its stub. |
| |
| <p><a name="index-PowerPC64-stub-symbols-717"></a><a name="index-g_t_002d_002demit_002dstub_002dsyms-718"></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-PowerPC64-dot-symbols-719"></a><a name="index-g_t_002d_002ddotsyms-720"></a><a name="index-g_t_002d_002dno_002ddotsyms-721"></a><br><dt><samp><span class="option">--dotsyms</span></samp><dt><samp><span class="option">--no-dotsyms</span></samp><dd>These two options control how <samp><span class="command">ld</span></samp> interprets version patterns |
| in a version script. Older PowerPC64 compilers emitted both a |
| function descriptor symbol with the same name as the function, and a |
| code entry symbol with the name prefixed by a dot (‘<samp><span class="samp">.</span></samp>’). To |
| properly version a function ‘<samp><span class="samp">foo</span></samp>’, the version script thus needs |
| to control both ‘<samp><span class="samp">foo</span></samp>’ and ‘<samp><span class="samp">.foo</span></samp>’. The option |
| ‘<samp><span class="samp">--dotsyms</span></samp>’, on by default, automatically adds the required |
| dot-prefixed patterns. Use ‘<samp><span class="samp">--no-dotsyms</span></samp>’ to disable this |
| feature. |
| |
| <p><a name="index-PowerPC64-register-save_002frestore-functions-722"></a><a name="index-g_t_002d_002dsave_002drestore_002dfuncs-723"></a><a name="index-g_t_002d_002dno_002dsave_002drestore_002dfuncs-724"></a><br><dt><samp><span class="option">--save-restore-funcs</span></samp><dt><samp><span class="option">--no-save-restore-funcs</span></samp><dd>These two options control whether PowerPC64 <samp><span class="command">ld</span></samp> automatically |
| provides out-of-line register save and restore functions used by |
| ‘<samp><span class="samp">-Os</span></samp>’ code. The default is to provide any such referenced |
| function for a normal final link, and to not do so for a relocatable |
| link. |
| |
| <p><a name="index-PowerPC64-TLS-optimization-725"></a><a name="index-g_t_002d_002dno_002dtls_002doptimize-726"></a><br><dt><samp><span class="option">--no-tls-optimize</span></samp><dd>PowerPC64 <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. |
| |
| <p><a name="index-PowerPC64-_005f_005ftls_005fget_005faddr-optimization-727"></a><a name="index-g_t_002d_002dtls_002dget_002daddr_002doptimize-728"></a><a name="index-g_t_002d_002dno_002dtls_002dget_002daddr_002doptimize-729"></a><br><dt><samp><span class="option">--tls-get-addr-optimize</span></samp><dt><samp><span class="option">--no-tls-get-addr-optimize</span></samp><dd>These options control whether PowerPC64 <samp><span class="command">ld</span></samp> uses a special |
| stub to call __tls_get_addr. PowerPC64 glibc 2.22 and later support |
| an optimization that allows the second and subsequent calls to |
| <code>__tls_get_addr</code> for a given symbol to be resolved by the special |
| stub without calling in to glibc. By default the linker enables this |
| option when glibc advertises the availability of __tls_get_addr_opt. |
| Forcing this option on when using an older glibc won't do much besides |
| slow down your applications, but may be useful if linking an |
| application against an older glibc with the expectation that it will |
| normally be used on systems having a newer glibc. |
| |
| <p><a name="index-PowerPC64-OPD-optimization-730"></a><a name="index-g_t_002d_002dno_002dopd_002doptimize-731"></a><br><dt><samp><span class="option">--no-opd-optimize</span></samp><dd>PowerPC64 <samp><span class="command">ld</span></samp> normally removes <code>.opd</code> section entries |
| corresponding to deleted link-once functions, or functions removed by |
| the action of ‘<samp><span class="samp">--gc-sections</span></samp>’ or linker script <code>/DISCARD/</code>. |
| Use this option to disable <code>.opd</code> optimization. |
| |
| <p><a name="index-PowerPC64-OPD-spacing-732"></a><a name="index-g_t_002d_002dnon_002doverlapping_002dopd-733"></a><br><dt><samp><span class="option">--non-overlapping-opd</span></samp><dd>Some PowerPC64 compilers have an option to generate compressed |
| <code>.opd</code> entries spaced 16 bytes apart, overlapping the third word, |
| the static chain pointer (unused in C) with the first word of the next |
| entry. This option expands such entries to the full 24 bytes. |
| |
| <p><a name="index-PowerPC64-TOC-optimization-734"></a><a name="index-g_t_002d_002dno_002dtoc_002doptimize-735"></a><br><dt><samp><span class="option">--no-toc-optimize</span></samp><dd>PowerPC64 <samp><span class="command">ld</span></samp> normally removes unused <code>.toc</code> section |
| entries. Such entries are detected by examining relocations that |
| reference the TOC in code sections. A reloc in a deleted code section |
| marks a TOC word as unneeded, while a reloc in a kept code section |
| marks a TOC word as needed. Since the TOC may reference itself, TOC |
| relocs are also examined. TOC words marked as both needed and |
| unneeded will of course be kept. TOC words without any referencing |
| reloc are assumed to be part of a multi-word entry, and are kept or |
| discarded as per the nearest marked preceding word. This works |
| reliably for compiler generated code, but may be incorrect if assembly |
| code is used to insert TOC entries. Use this option to disable the |
| optimization. |
| |
| <p><a name="index-PowerPC64-multi_002dTOC-736"></a><a name="index-g_t_002d_002dno_002dmulti_002dtoc-737"></a><br><dt><samp><span class="option">--no-multi-toc</span></samp><dd>If given any toc option besides <code>-mcmodel=medium</code> or |
| <code>-mcmodel=large</code>, PowerPC64 GCC generates code for a TOC model |
| where TOC |
| entries are accessed with a 16-bit offset from r2. This limits the |
| total TOC size to 64K. PowerPC64 <samp><span class="command">ld</span></samp> extends this limit by |
| grouping code sections such that each group uses less than 64K for its |
| TOC entries, then inserts r2 adjusting stubs between inter-group |
| calls. <samp><span class="command">ld</span></samp> does not split apart input sections, so cannot |
| help if a single input file has a <code>.toc</code> section that exceeds |
| 64K, most likely from linking multiple files with <samp><span class="command">ld -r</span></samp>. |
| Use this option to turn off this feature. |
| |
| <p><a name="index-PowerPC64-TOC-sorting-738"></a><a name="index-g_t_002d_002dno_002dtoc_002dsort-739"></a><br><dt><samp><span class="option">--no-toc-sort</span></samp><dd>By default, <samp><span class="command">ld</span></samp> sorts TOC sections so that those whose file |
| happens to have a section called <code>.init</code> or <code>.fini</code> are |
| placed first, followed by TOC sections referenced by code generated |
| with PowerPC64 gcc's <code>-mcmodel=small</code>, and lastly TOC sections |
| referenced only by code generated with PowerPC64 gcc's |
| <code>-mcmodel=medium</code> or <code>-mcmodel=large</code> options. Doing this |
| results in better TOC grouping for multi-TOC. Use this option to turn |
| off this feature. |
| |
| <p><a name="index-PowerPC64-PLT-stub-alignment-740"></a><a name="index-g_t_002d_002dplt_002dalign-741"></a><a name="index-g_t_002d_002dno_002dplt_002dalign-742"></a><br><dt><samp><span class="option">--plt-align</span></samp><dt><samp><span class="option">--no-plt-align</span></samp><dd>Use these options to control whether individual PLT call stubs are |
| aligned to a 32-byte boundary, or to the specified power of two |
| boundary when using <code>--plt-align=</code>. A negative value may be |
| specified to pad PLT call stubs so that they do not cross the |
| specified power of two boundary (or the minimum number of boundaries |
| if a PLT stub is so large that it must cross a boundary). By default |
| PLT call stubs are aligned to 32-byte boundaries. |
| |
| <p><a name="index-PowerPC64-PLT-call-stub-static-chain-743"></a><a name="index-g_t_002d_002dplt_002dstatic_002dchain-744"></a><a name="index-g_t_002d_002dno_002dplt_002dstatic_002dchain-745"></a><br><dt><samp><span class="option">--plt-static-chain</span></samp><dt><samp><span class="option">--no-plt-static-chain</span></samp><dd>Use these options to control whether PLT call stubs load the static |
| chain pointer (r11). <code>ld</code> defaults to not loading the static |
| chain since there is never any need to do so on a PLT call. |
| |
| <p><a name="index-PowerPC64-PLT-call-stub-thread-safety-746"></a><a name="index-g_t_002d_002dplt_002dthread_002dsafe-747"></a><a name="index-g_t_002d_002dno_002dplt_002dthread_002dsafe-748"></a><br><dt><samp><span class="option">--plt-thread-safe</span></samp><dt><samp><span class="option">--no-plt-thread-safe</span></samp><dd>With power7's weakly ordered memory model, it is possible when using |
| lazy binding for ld.so to update a plt entry in one thread and have |
| another thread see the individual plt entry words update in the wrong |
| order, despite ld.so carefully writing in the correct order and using |
| memory write barriers. To avoid this we need some sort of read |
| barrier in the call stub, or use LD_BIND_NOW=1. By default, <code>ld</code> |
| looks for calls to commonly used functions that create threads, and if |
| seen, adds the necessary barriers. Use these options to change the |
| default behaviour. |
| |
| <p><a name="index-PowerPC64-ELFv2-PLT-localentry-optimization-749"></a><a name="index-g_t_002d_002dplt_002dlocalentry-750"></a><a name="index-g_t_002d_002dno_002dplt_002dlocalentry-751"></a><br><dt><samp><span class="option">--plt-localentry</span></samp><dt><samp><span class="option">--no-localentry</span></samp><dd>ELFv2 functions with localentry:0 are those with a single entry point, |
| ie. global entry == local entry, and that have no requirement on r2 |
| (the TOC/GOT pointer) or r12, and guarantee r2 is unchanged on return. |
| Such an external function can be called via the PLT without saving r2 |
| or restoring it on return, avoiding a common load-hit-store for small |
| functions. The optimization is attractive, with up to 40% reduction |
| in execution time for a small function, but can result in symbol |
| interposition failures. Also, minor changes in a shared library, |
| including system libraries, can cause a function that was localentry:0 |
| to become localentry:8. This will result in a dynamic loader |
| complaint and failure to run. The option is experimental, use with |
| care. <samp><span class="option">--no-plt-localentry</span></samp> is the default. |
| </dl> |
| |
| </body></html> |
| |