[PATCH] D62365: ELF: Don't reuse a thunk in a different loadable partition.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 24 18:06:33 PDT 2019


pcc added inline comments.


================
Comment at: lld/ELF/Relocations.cpp:1626
   for (Thunk *T : *ThunkVec)
-    if (T->isCompatibleWith(Type) &&
+    if (T->getThunkTargetSym()->Section->Partition == IS->Partition &&
+        T->isCompatibleWith(Type) &&
----------------
peter.smith wrote:
> There are some other cases where we won't want to reuse across an OutputSection boundary, for example when the OutputSections are overlays. Would it be worth extracting into something like if (CompatibleOutputSections(T->getThunkTargetSym()->Section, IS)) where we could add to these conditions.
Makes sense. While moving this out to a function I took the opportunity to introduce a small optimization: if the thunk is in the main partition, we can always call it because it will always be loaded.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62365





More information about the llvm-commits mailing list