[PATCH] D86706: [LLD][PowerPC] Add pc-rel based long branch thunks

Victor Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 14:34:27 PDT 2020


NeHuang marked 2 inline comments as done.
NeHuang added inline comments.


================
Comment at: lld/ELF/Thunks.cpp:966
+void PPC64PCRelLongBranchThunk::writeTo(uint8_t *buf) {
+  int64_t offset = destination.getVA(addend) - getThunkTargetSym()->getVA();
+  if (!isInt<34>(offset))
----------------
sfertile wrote:
> I don't believe we have accounted for the addend in the other PPC64 thunks (both toc-based and pc-rel based). If we do take into account the addend then we have to account for that in 'isCompatableWith' as well.  I don't believe the compilers emit calls instructions using both symbol and addends (or we likely would have realized this earlier). I suggest to keep it simple we follow the example of the other thinks and omit the addend, or potentially error on a non-zero addend. We can then revisit this in a subsequent patch where we fix all the thunks that will need to account for the addend. 
Agree, will omit the addend in this thunk o be consistent with other PPC64 thunks, we can fix all the thunks to account for the addend in a subsequent patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86706/new/

https://reviews.llvm.org/D86706



More information about the llvm-commits mailing list