[PATCH] D44284: ELF: Do not create multiple thunks for the same virtual address.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 8 20:07:25 PST 2018


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

LGTM



================
Comment at: lld/ELF/Relocations.cpp:1243
                                                 uint64_t Src) {
-  auto Res = ThunkedSymbols.insert({&Sym, std::vector<Thunk *>()});
-  if (!Res.second) {
-    // Check existing Thunks for Sym to see if they can be reused
-    for (Thunk *ET : Res.first->second)
-      if (ET->isCompatibleWith(Type) &&
-          Target->inBranchRange(Type, Src, ET->ThunkSym->getVA()))
-        return std::make_pair(ET, false);
-  }
+  std::vector<Thunk *> *ThunkVec = nullptr;
+  if (auto *D = dyn_cast<Defined>(&Sym))
----------------
Please add a comment saying that we use (section, offset) pair to find thunk position if possible so that we create only one thunk for aliased symbols or ICFed sections.


https://reviews.llvm.org/D44284





More information about the llvm-commits mailing list