[PATCH] D82950: [PowerPC] Support PCRelative Callees for R_PPC64_REL24 Relocation

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 05:22:49 PDT 2020


stefanp created this revision.
stefanp added reviewers: nemanjai, sfertile, MaskRay, ruiu, hfinkel.
Herald added subscribers: shchenz, kbarton, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

The R_PPC64_REL24 is used in function calls when the caller requires a
valid TOC pointer. If the callee shares the same TOC or does not clobber
the TOC pointer then a direct call can be made. If the callee does not
share the TOC a thunk must be added to save the TOC pointer for the caller.

Up until PC Relative was introduced all local calls on medium and large code
models were assumed to share a TOC. This is no longer the case because
if the caller requires a TOC and the callee is PC Relative then the callee
can clobber the TOC even if it is in the same DSO.

This patch is to add support for a TOC caller calling a PC Relative callee that
clobbers the TOC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82950

Files:
  lld/ELF/Arch/PPC64.cpp
  lld/ELF/Thunks.cpp
  lld/test/ELF/ppc64-toc-call-to-pcrel.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82950.274762.patch
Type: text/x-patch
Size: 4563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200701/346f63ec/attachment.bin>


More information about the llvm-commits mailing list