[PATCH] D82950: [PowerPC] Support PCRelative Callees for R_PPC64_REL24 Relocation

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 11:48:07 PDT 2020


stefanp added inline comments.


================
Comment at: lld/ELF/Thunks.cpp:842
+  write32(buf + 0, 0xf8410018);                         // std  r2,24(r1)
+  write32(buf + 4, 0x48000000 | (offset & 0x03fffffc)); // b    <offset>
+}
----------------
sfertile wrote:
> What happens if offset doesn't fit within 26 bits?
Good point.
Right now we just drop the extra bits from the offset and jump to an incorrect offset.

I'll add an error to fail at this point if the offset does not fit in the 26 bits.


================
Comment at: lld/ELF/Thunks.cpp:846
+void PPC64R2SaveStub::addSymbols(ThunkSection &isec) {
+  Defined *s = addSymbol(saver.save("__long_branch_" + destination.getName()),
+                         STT_FUNC, 0, isec);
----------------
sfertile wrote:
> This is being named the same as a branch extending thunk (ie a trampoline for when the call is too far to represent with a single call instruction). The name we create shoud represent the thunk type, it makes reading disassembly much easier. How about "__toc_save_` instead?
The reason I had used this name was because GCC used `long_branch.callee` as the name as well so I figured I would do the same thing. However, I do like the idea of calling it `__toc_save` better so I'm going to use that instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82950





More information about the llvm-commits mailing list