[PATCH] D46204: [PPC64] V2 abi: Emit plt call stubs to the text section rather then the plt section.

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 12:11:29 PDT 2018


sfertile created this revision.
sfertile added reviewers: syzaara, ruiu, espindola, rdhindsa.
Herald added subscribers: kbarton, arichardson, nemanjai, emaste.

In https://reviews.llvm.org/D45642 I was made aware that the `.plt` section is typically used for lazy symbol resolution stubs. Unfortunately we are writing the plt call stubs to that section for the PPC64 target. This patch implements plt call stubs as thunks. This enables them to be written to the proper section (`.text` rather then `.plt`)  and frees up the `.plt` section for the lazy symbol resolvers.

Calls on PPC64 that potentially transfer control to a different linkage-unit need to be followed by a 'toc restore'.  Previously we could determine a call needed a toc-restore by the R_PPC_PLT_OPD expr type. When redirecting to the thunks though we map that expr back to the non-plt expr (R_PPC_OPD). I've extended symbols with an extra field that records if a call to said symbol needs to be followed by a toc restore so we can differentiate R_PPC_OPD calls that need a toc-restore vs those that do not.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46204

Files:
  ELF/Arch/PPC64.cpp
  ELF/InputSection.cpp
  ELF/Symbols.h
  ELF/Thunks.cpp
  test/ELF/ppc64-ifunc.s
  test/ELF/ppc64-toc-restore.s
  test/ELF/ppc64le-plt-stub.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46204.144374.patch
Type: text/x-patch
Size: 14152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180427/87a0037a/attachment.bin>


More information about the llvm-commits mailing list