[PATCH] D83504: [PowerPC] Implement R_PPC64_REL24_NOTOC local calls. callee has a TOC

Victor Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 15:10:50 PDT 2020


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


================
Comment at: lld/ELF/Thunks.cpp:842
+
+  writePrefixedInstruction(buf + 0, (prefix << 32) | suffix); // pld r12, func at plt@pcrel
+  write32(buf + 8, 0x7d8903a6);                               // mtctr r12
----------------
NeHuang wrote:
> sfertile wrote:
> > sfertile wrote:
> > > Comment is wrong. `destination.getVA() - getThunkTargetSym()->getVA()` is the pc-relative offset to the function (`func at pcrel`), not the offset to the functions plt entry. 
> > Sorry, I missed that the comment also says the instruction is a `pld` which would be correct if we are loading the symbols address from the plt, but this thunk type is for functions **not** in the plt. Do you intend to load the address of the function out of a table? or do you meant to calculate the address relative to the program counter?
> Good catch! Updated it accordingly. 
No worries. Right, should load the symbol address from the plt instead so that we can use `pld` to load the callee's global entry point to r12.  Will update it accordingly. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83504





More information about the llvm-commits mailing list