[PATCH] D82950: [PowerPC] Support PCRelative Callees for R_PPC64_REL24 Relocation
Sean Fertile via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 3 07:30:33 PDT 2020
sfertile added inline comments.
================
Comment at: lld/ELF/Thunks.cpp:287
+// 1) Saves the TOC pointer to the stack.
+// 2) Branch directly to the callee.
+class PPC64R2SaveStub final : public Thunk {
----------------
anil9 wrote:
> Branch -> Branches/Jumps
Alternatively: `2) Tails calls the callee`
================
Comment at: lld/ELF/Thunks.cpp:842
+ write32(buf + 0, 0xf8410018); // std r2,24(r1)
+ write32(buf + 4, 0x48000000 | (offset & 0x03fffffc)); // b <offset>
+}
----------------
What happens if offset doesn't fit within 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);
----------------
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?
================
Comment at: lld/test/ELF/ppc64-error-toc-local-call.s:37
+ b callee # 0x2C
+ #TC_RETURNd8 callee 0
----------------
nit: remove the compiler generated comments.
================
Comment at: lld/test/ELF/ppc64-toc-call-to-pcrel.s:62
+ .size global, 4
+
----------------
nit: remove extra blank line.
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