[PATCH] D27158: Use relocations to fill statically known got entries

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 07:21:22 PST 2016


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM with all comments addressed.



================
Comment at: lld/ELF/SyntheticSections.cpp:405
+  TlsIndexOff = NumEntries * sizeof(uintX_t);
+  NumEntries += 2;
   return true;
----------------
Thank you for doing this. push_back'ing two nullptrs looked odd.


================
Comment at: lld/ELF/SyntheticSections.cpp:432
 template <class ELFT> void GotSection<ELFT>::writeTo(uint8_t *Buf) {
-  for (const SymbolBody *B : Entries) {
-    uint8_t *Entry = Buf;
-    Buf += sizeof(uintX_t);
-    if (!B)
-      continue;
-    if (B->isPreemptible())
-      continue; // The dynamic linker will take care of it.
-    uintX_t VA = B->getVA<ELFT>();
-    write<uintX_t, ELFT::TargetEndianness, sizeof(uintX_t)>(Entry, VA);
-  }
+  uint8_t *BufEnd = Buf + Size;
+  this->relocate(Buf, BufEnd);
----------------
nit: you can just inline this.


================
Comment at: lld/ELF/Target.cpp:805
   case R_X86_64_PC64:
+  case R_X86_64_GLOB_DAT:
     write64le(Loc, Val);
----------------
sort


https://reviews.llvm.org/D27158





More information about the llvm-commits mailing list