[lld] [LLD][ELF] Do not reuse thunks in OVERLAYs (PR #200415)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 07:03:46 PDT 2026


================
@@ -1788,6 +1788,19 @@ ThunkSection *ThunkCreator::addThunkSection(OutputSection *os,
   return ts;
 }
 
+static bool isThunkSectionCompatible(InputSection *source,
+                                     SectionBase *target) {
+  OutputSection *sourceOS = source->getOutputSection();
+  OutputSection *targetOS = target->getOutputSection();
+  assert(sourceOS && targetOS);
+  // Thunks in a different Overlay Output Section can't be reused
+  // as we can't guarantee that the Overlay will be in memory.
+  if (sourceOS != targetOS && targetOS->inOverlay)
----------------
smithp35 wrote:

ACK.

https://github.com/llvm/llvm-project/pull/200415


More information about the llvm-commits mailing list