[PATCH] D83669: [PowerPC] Support for R_PPC64_REL24_NOTOC calls where the caller has no TOC and the callee is not DSO local

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 07:46:48 PDT 2020


sfertile added inline comments.


================
Comment at: lld/ELF/Arch/PPC64.cpp:1038
 
-  // FIXME: Remove the fatal error once the call protocol is implemented.
   if (type == R_PPC64_REL24_NOTOC && s.isInPlt())
+    return true;
----------------
No need for a extra case to handle the NOTOC plt calls, the following case handles it perfectly.


================
Comment at: lld/ELF/Thunks.cpp:308
 
+// PPC64 Plt R12 Setup Stub
+// When a caller that does not maintain a toc-pointer performs an extern call
----------------
If you look at the existing plt stub it also sets up R12, this is expected of any plt stub variety on PPC64. The important details about this stub type is that it is a plt stub that uses pc-relative instructions, that it sets up R12 is just an implementation detail.
```// PPC64 PLT R12 Setup Stub```  
-->
 ``` // PPC64 PC-relative PLT Stub```
 


================
Comment at: lld/ELF/Thunks.cpp:315
+// 2) Transferring control to the target function through an indirect branch.
+class PPC64PltR12SetupStub final : public Thunk {
+public:
----------------
Change the name to `PPC64PCRelPLTStub`.


================
Comment at: lld/ELF/Thunks.cpp:911
+void PPC64PltR12SetupStub::addSymbols(ThunkSection &isec) {
+  addSymbol(saver.save("__plt_gep_setup_" + destination.getName()), STT_FUNC, 0,
+            isec);
----------------
Both plt stub types perform the setup for the gep so the name doesn't really disambiguate which  stub type we have. I suggest trying to use pc-rel in the name instead of gep.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83669





More information about the llvm-commits mailing list