[PATCH] D53408: [PPC64] Long branch thunks.

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 18 12:27:29 PDT 2018


sfertile created this revision.
sfertile added reviewers: syzaara, ruiu, rdhindsa, MaskRay.
sfertile added a project: lld.
Herald added subscribers: jsji, kbarton, arichardson, nemanjai, emaste.
Herald added a reviewer: espindola.

On PowerPC64, when a  function call offset is too large to encode in a call instruction the address is stored in a table in the data segment. A thunk is used to load the branch target address from the table relative to the TOC-pointer and indirectly branch to the callee. When linking position-dependent code the addresses are stored directly in the table, for position-independent code the table is allocated and filled in at load time by the dynamic linker.

For position-independent code the branch targets could have also gone in either the .got.plt or .igot.plt, but since the handling of the .got.plt/.igot.plt is already somewhat complicated and the .branch_lt section is needed for the position-dependent case anyway, I thought it was clearer to use the new section in both cases.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53408

Files:
  ELF/Arch/PPC64.cpp
  ELF/Relocations.cpp
  ELF/Symbols.cpp
  ELF/Symbols.h
  ELF/SyntheticSections.cpp
  ELF/SyntheticSections.h
  ELF/Thunks.cpp
  ELF/Writer.cpp
  test/ELF/basic-ppc64.s
  test/ELF/basic64be.s
  test/ELF/ppc64-call-reach.s
  test/ELF/ppc64-long-branch.s
  test/ELF/ppc64-shared-long_branch.s
  test/ELF/ppc64-tls-gd-le-small.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53408.170106.patch
Type: text/x-patch
Size: 36104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181018/a46bc0a7/attachment.bin>


More information about the llvm-commits mailing list