[PATCH] D150631: [LLD] Emit DT_PPC64_OPT into the dynamic section

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 18:52:18 PDT 2023


stefanp created this revision.
stefanp added reviewers: nemanjai, lei, amyk.
Herald added subscribers: shchenz, kbarton, arichardson, emaste.
Herald added a reviewer: MaskRay.
Herald added a project: All.
stefanp requested review of this revision.
Herald added a project: LLVM.

As per section 4.2.2, 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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150631

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150631.522407.patch
Type: text/x-patch
Size: 33498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230516/162e3861/attachment.bin>


More information about the llvm-commits mailing list