[all-commits] [llvm/llvm-project] beb52b: [PowerPC] Support PCRelative Callees for R_PPC64_R...

Kamau Bridgeman via All-commits all-commits at lists.llvm.org
Thu Jul 9 07:51:17 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: beb52b12cb175d0df9bf168837d153f857f69eda
      https://github.com/llvm/llvm-project/commit/beb52b12cb175d0df9bf168837d153f857f69eda
  Author: Stefan Pintilie <stefanp at ca.ibm.com>
  Date:   2020-07-09 (Thu, 09 Jul 2020)

  Changed paths:
    M lld/ELF/Arch/PPC64.cpp
    M lld/ELF/Thunks.cpp
    A lld/test/ELF/ppc64-error-toc-local-call.s
    A lld/test/ELF/ppc64-toc-call-to-pcrel-long-jump.s
    A lld/test/ELF/ppc64-toc-call-to-pcrel.s

  Log Message:
  -----------
  [PowerPC] Support PCRelative Callees for R_PPC64_REL24 Relocation

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.

Reviewed By: sfertile, MaskRay

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




More information about the All-commits mailing list