[PATCH] D83504: [PowerPC] Implement R_PPC64_REL24_NOTOC local calls. callee has a TOC
    Sean Fertile via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Jul 13 13:03:18 PDT 2020
    
    
  
sfertile 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
----------------
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?
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