ld: PowerPC64 ELF64

1 
1 4.13 'ld' and PowerPC64 64-bit ELF Support
1 ==========================================
1 
1 '--stub-group-size'
1      Long branch stubs, PLT call stubs and TOC adjusting stubs are
1      placed by 'ld' in stub sections located between groups of input
1      sections.  '--stub-group-size' specifies the maximum size of a
1      group of input sections handled by one stub section.  Since branch
1      offsets are signed, a stub section may serve two groups of input
1      sections, one group before the stub section, and one group after
1      it.  However, when using conditional branches that require stubs,
1      it may be better (for branch prediction) that stub sections only
1      serve one group of input sections.  A negative value for 'N'
1      chooses this scheme, ensuring that branches to stubs always use a
1      negative offset.  Two special values of 'N' are recognized, '1' and
1      '-1'.  These both instruct 'ld' to automatically size input section
1      groups for the branch types detected, with the same behaviour
1      regarding stub placement as other positive or negative values of
1      'N' respectively.
1 
1      Note that '--stub-group-size' does not split input sections.  A
1      single input section larger than the group size specified will of
1      course create a larger group (of one section).  If input sections
1      are too large, it may not be possible for a branch to reach its
1      stub.
1 
1 '--emit-stub-syms'
1      This option causes 'ld' to label linker stubs with a local symbol
1      that encodes the stub type and destination.
1 
1 '--dotsyms'
1 '--no-dotsyms'
1      These two options control how 'ld' interprets version patterns in a
1      version script.  Older PowerPC64 compilers emitted both a function
1      descriptor symbol with the same name as the function, and a code
1      entry symbol with the name prefixed by a dot ('.').  To properly
1      version a function 'foo', the version script thus needs to control
1      both 'foo' and '.foo'.  The option '--dotsyms', on by default,
1      automatically adds the required dot-prefixed patterns.  Use
1      '--no-dotsyms' to disable this feature.
1 
1 '--save-restore-funcs'
1 '--no-save-restore-funcs'
1      These two options control whether PowerPC64 'ld' automatically
1      provides out-of-line register save and restore functions used by
1      '-Os' code.  The default is to provide any such referenced function
1      for a normal final link, and to not do so for a relocatable link.
1 
1 '--no-tls-optimize'
1      PowerPC64 'ld' normally performs some optimization of code
1      sequences used to access Thread-Local Storage.  Use this option to
1      disable the optimization.
1 
1 '--tls-get-addr-optimize'
1 '--no-tls-get-addr-optimize'
1      These options control whether PowerPC64 'ld' uses a special stub to
1      call __tls_get_addr.  PowerPC64 glibc 2.22 and later support an
1      optimization that allows the second and subsequent calls to
1      '__tls_get_addr' for a given symbol to be resolved by the special
1      stub without calling in to glibc.  By default the linker enables
1      this option when glibc advertises the availability of
1      __tls_get_addr_opt.  Forcing this option on when using an older
1      glibc won't do much besides slow down your applications, but may be
1      useful if linking an application against an older glibc with the
1      expectation that it will normally be used on systems having a newer
1      glibc.
1 
1 '--no-opd-optimize'
1      PowerPC64 'ld' normally removes '.opd' section entries
1      corresponding to deleted link-once functions, or functions removed
1      by the action of '--gc-sections' or linker script '/DISCARD/'.  Use
1      this option to disable '.opd' optimization.
1 
1 '--non-overlapping-opd'
1      Some PowerPC64 compilers have an option to generate compressed
1      '.opd' entries spaced 16 bytes apart, overlapping the third word,
1      the static chain pointer (unused in C) with the first word of the
1      next entry.  This option expands such entries to the full 24 bytes.
1 
1 '--no-toc-optimize'
1      PowerPC64 'ld' normally removes unused '.toc' section entries.
1      Such entries are detected by examining relocations that reference
1      the TOC in code sections.  A reloc in a deleted code section marks
1      a TOC word as unneeded, while a reloc in a kept code section marks
1      a TOC word as needed.  Since the TOC may reference itself, TOC
1      relocs are also examined.  TOC words marked as both needed and
1      unneeded will of course be kept.  TOC words without any referencing
1      reloc are assumed to be part of a multi-word entry, and are kept or
1      discarded as per the nearest marked preceding word.  This works
1      reliably for compiler generated code, but may be incorrect if
1      assembly code is used to insert TOC entries.  Use this option to
1      disable the optimization.
1 
1 '--no-multi-toc'
1      If given any toc option besides '-mcmodel=medium' or
1      '-mcmodel=large', PowerPC64 GCC generates code for a TOC model
1      where TOC entries are accessed with a 16-bit offset from r2.  This
1      limits the total TOC size to 64K. PowerPC64 'ld' extends this limit
1      by grouping code sections such that each group uses less than 64K
1      for its TOC entries, then inserts r2 adjusting stubs between
1      inter-group calls.  'ld' does not split apart input sections, so
1      cannot help if a single input file has a '.toc' section that
1      exceeds 64K, most likely from linking multiple files with 'ld -r'.
1      Use this option to turn off this feature.
1 
1 '--no-toc-sort'
1      By default, 'ld' sorts TOC sections so that those whose file
1      happens to have a section called '.init' or '.fini' are placed
1      first, followed by TOC sections referenced by code generated with
1      PowerPC64 gcc's '-mcmodel=small', and lastly TOC sections
1      referenced only by code generated with PowerPC64 gcc's
1      '-mcmodel=medium' or '-mcmodel=large' options.  Doing this results
1      in better TOC grouping for multi-TOC. Use this option to turn off
1      this feature.
1 
1 '--plt-align'
1 '--no-plt-align'
1      Use these options to control whether individual PLT call stubs are
1      aligned to a 32-byte boundary, or to the specified power of two
1      boundary when using '--plt-align='.  A negative value may be
1      specified to pad PLT call stubs so that they do not cross the
1      specified power of two boundary (or the minimum number of
1      boundaries if a PLT stub is so large that it must cross a
1      boundary).  By default PLT call stubs are aligned to 32-byte
1      boundaries.
1 
1 '--plt-static-chain'
1 '--no-plt-static-chain'
1      Use these options to control whether PLT call stubs load the static
1      chain pointer (r11).  'ld' defaults to not loading the static chain
1      since there is never any need to do so on a PLT call.
1 
1 '--plt-thread-safe'
1 '--no-plt-thread-safe'
1      With power7's weakly ordered memory model, it is possible when
1      using lazy binding for ld.so to update a plt entry in one thread
1      and have another thread see the individual plt entry words update
1      in the wrong order, despite ld.so carefully writing in the correct
1      order and using memory write barriers.  To avoid this we need some
1      sort of read barrier in the call stub, or use LD_BIND_NOW=1.  By
1      default, 'ld' looks for calls to commonly used functions that
1      create threads, and if seen, adds the necessary barriers.  Use
1      these options to change the default behaviour.
1 
1 '--plt-localentry'
1 '--no-localentry'
1      ELFv2 functions with localentry:0 are those with a single entry
1      point, ie.  global entry == local entry, and that have no
1      requirement on r2 (the TOC/GOT pointer) or r12, and guarantee r2 is
1      unchanged on return.  Such an external function can be called via
1      the PLT without saving r2 or restoring it on return, avoiding a
1      common load-hit-store for small functions.  The optimization is
1      attractive, with up to 40% reduction in execution time for a small
1      function, but can result in symbol interposition failures.  Also,
1      minor changes in a shared library, including system libraries, can
1      cause a function that was localentry:0 to become localentry:8.
1      This will result in a dynamic loader complaint and failure to run.
1      The option is experimental, use with care.  '--no-plt-localentry'
1      is the default.
1