[PATCH] D54720: [PPC64] toc-indirect to toc-relative relaxation.

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 31 13:31:48 PST 2019


sfertile marked an inline comment as done.
sfertile added inline comments.


================
Comment at: ELF/Arch/PPC64.cpp:137
+  // have less relocations then toc enties and Relas[Index] is the last reloc
+  // in the array. In this case we have nothing to relax to.
+  if (Offset > Relas[Index].r_offset)
----------------
ruiu wrote:
> I think I don't understand why you can't relax if the number of relocations for the .toc is smaller than the number of entires in .toc. I thought that if you can find a relocation that has a specific offset, that's the relocation that you are looking for, and you can read a symbol and an offset from that relocation. I think there's something more about PPC64 ABI that I don't know of. Could you explain?
I think the missing piece here is that I am assuming each toc entry has at most 1 relocation.  The relocations are R_PPC64_ADDR64 and relocates one full entry each, or we have a constant/value with no relocation. That way a look up should always find an `r_offset` greater then or equal to `Offset` on the first look-up, //except //for when we truncated the index because the one we calculated was outside the array bounds. If we truncated the index and find a `r_offset < Offset` we can return because the array is sorted by offset.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D54720





More information about the llvm-commits mailing list