[all-commits] [llvm/llvm-project] 658f23: [LLD] Emit DT_PPC64_OPT into the dynamic section

stefanp-ibm via All-commits all-commits at lists.llvm.org
Mon Jun 5 09:18:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 658f23fc462e2fbdddaa056e5cda998653b55b21
      https://github.com/llvm/llvm-project/commit/658f23fc462e2fbdddaa056e5cda998653b55b21
  Author: Stefan Pintilie <stefanp at ca.ibm.com>
  Date:   2023-06-05 (Mon, 05 Jun 2023)

  Changed paths:
    M lld/ELF/SyntheticSections.cpp
    M lld/ELF/Target.h
    M lld/ELF/Thunks.cpp
    M lld/test/ELF/basic-ppc64.s
    M lld/test/ELF/ppc-reloc-copy.s
    M lld/test/ELF/ppc64-abs64-dyn.s
    M lld/test/ELF/ppc64-bsymbolic-toc-restore.s
    M lld/test/ELF/ppc64-check-missing-tocbase.s
    M lld/test/ELF/ppc64-dtprel.s
    M lld/test/ELF/ppc64-local-dynamic.s
    M lld/test/ELF/ppc64-long-branch-pi.s
    M lld/test/ELF/ppc64-pcrel-call-to-extern.s
    M lld/test/ELF/ppc64-pcrel-long-branch.s
    M lld/test/ELF/ppc64-plt-stub-compatible.s
    M lld/test/ELF/ppc64-plt-stub.s
    M lld/test/ELF/ppc64-reloc-got-pcrel34.s
    M lld/test/ELF/ppc64-tls-gd.s
    M lld/test/ELF/ppc64-tls-ie.s
    M lld/test/ELF/ppc64-tls-pcrel-gd.s
    M lld/test/ELF/ppc64-tls-pcrel-ie.s
    M lld/test/ELF/ppc64-tls-pcrel-ld.s
    M lld/test/ELF/ppc64-toc-relax-constants.s
    M lld/test/ELF/ppc64-toc-relax.s
    M llvm/include/llvm/BinaryFormat/DynamicTags.def

  Log Message:
  -----------
  [LLD] Emit DT_PPC64_OPT into the dynamic section

As per section 4.2.2 of the PowerPC ELFv2 ABI, this value tells the dynamic linker which optimizations it is allowed to do.
Specifically, the higher order bit of the two tells the dynamic linker that there may be multiple TOC pointers in the binary.

When we resolve any NOTOC relocations during linking, we need to set this value because we may be calling
TOC functions from NOTOC functions when the NOTOC function already clobbered the TOC pointer.

In practice, this ensures that the PLT resolver always resolves the call to the GEP (global entry point) of
the TOC function (which will set up the TOC for the TOC function).

Original patch by nemanjai

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D150631




More information about the All-commits mailing list