[all-commits] [llvm/llvm-project] e0a372: [PowerPC] Extend .reloc directive on PowerPC

stefanp-ibm via All-commits all-commits at lists.llvm.org
Wed Jul 22 02:26:19 PDT 2020


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

  Changed paths:
    M llvm/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def
    M llvm/lib/MC/MCObjectStreamer.cpp
    A llvm/test/MC/PowerPC/ppc64-reloc-directive-pcrel.s

  Log Message:
  -----------
  [PowerPC] Extend .reloc directive on PowerPC

When the compiler generates a GOT indirect load it must generate two loads. One
that loads the address of the element from the GOT and a second to load the
actual element based on the address just loaded from the GOT. However, the
linker can optimize these two loads into one load if it knows that it is safe
to do so. The compiler can tell the linker that the optimization is safe
by using the R_PPC64_PCREL_OPT relocation.

This patch extends the .reloc directive to allow the following setup

  pld 3, vec at got@pcrel(0), 1
.Lpcrel1=.-8
      ... More instructions possible here ...
.reloc .Lpcrel1,R_PPC64_PCREL_OPT,.-.Lpcrel1
  lwa 3, 4(3)

Reviewers: nemanjai, lei, hfinkel, sfertile, efriedma, tstellar, grosbach, MaskRay

Reviewed By: nemanjai, MaskRay

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




More information about the All-commits mailing list