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

Victor Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 12:19:29 PDT 2020


NeHuang marked 3 inline comments as done.
NeHuang added inline comments.


================
Comment at: lld/ELF/Arch/PPC64.cpp:113
+}
+
 static bool addOptional(StringRef name, uint64_t value,
----------------
stefanp wrote:
> nit: Why was this moved up and the comment deleted?
> I assume it was something that the rebase did...
The comment was moved to (line 216) in `lld/ELF/Target.h`  when I added the function declaration there. 


================
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
----------------
stefanp wrote:
> 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.
Good point! will do. 


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