[PATCH] D46204: [PPC64] V2 abi: Emit plt call stubs to the text section rather then the plt section.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 3 10:21:12 PDT 2018


ruiu added inline comments.


================
Comment at: ELF/Arch/PPC64.cpp:293
+  // a call stub.
+  return S.isInPlt();
+}
----------------
nit: I'd combine it to `return Type == R_PPC64_REL24 && S.isInPlt();`



================
Comment at: ELF/Thunks.cpp:196
+
+// PPC64 Plt call stubs.
+class PPC64PltCallStub final : public Thunk {
----------------
Could you expand the comment to explain what PPC64 PLT call stub is and why we need it?


================
Comment at: ELF/Thunks.cpp:511-512
+
+void PPC64PltCallStub::addSymbols(ThunkSection &IS)
+{
+  Defined *S = addSymbol(Saver.save("__plt_" + Destination.getName()), STT_FUNC,
----------------
Coding style.


================
Comment at: ELF/Thunks.cpp:562-563
+static Thunk *addThunkPPC64(RelType Type, Symbol &S) {
+  switch(Type) {
+  case R_PPC64_REL24:
+    return make<PPC64PltCallStub>(S);
----------------
`if (Type == R_PPC64_REL24) return ...` is perhaps better.


================
Comment at: ELF/Thunks.cpp:572-576
   else if (Config->EMachine == EM_ARM)
     return addThunkArm(Type, S);
   else if (Config->EMachine == EM_MIPS)
     return addThunkMips(Type, S);
+  else if (Config->EMachine == EM_PPC64)
----------------
While you are here, could you remove `else` from these lines? We normally don't write `else` after `return`.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46204





More information about the llvm-commits mailing list