[PATCH] D83504: [PowerPC] Implement R_PPC64_REL24_NOTOC local calls. callee has a TOC

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 11:46:30 PDT 2020


stefanp added a comment.

I only had a couple of comments.
Overall I think this looks good.



================
Comment at: lld/ELF/Arch/PPC64.cpp:113
+}
+
 static bool addOptional(StringRef name, uint64_t value,
----------------
nit: Why was this moved up and the comment deleted?
I assume it was something that the rebase did...


================
Comment at: lld/ELF/Thunks.cpp:873
+
+  writePrefixedInstruction(buf + 0, (prefix << 32) | suffix); // paddi r12, 0, func at pcrel, 1
+  write32(buf + 8, MTCTR_R12);                                // mtctr r12
----------------
I feel like there may be an easier way to do this without all of the shifts:
```
uint64_t paddi = PADDI_R12_NO_DISP |
                 (((offset >> 16) & 0x3ffff) << 32) |
                 (offset & 0xffff);
	​
writePrefixedInstruction(buf + 0, paddi); // paddi r12, 0, func at pcrel, 1
```
That way you won't have to break the instruction apart and then put it back together.


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