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.
If the file was compiled with gcc -Bsymbolic -fPIC, there may not be a nop after bl.
If the symbol also requires a PLT (its NeedsTocRestore will be true), this check will fail.