[lld] [lld][MachO] Fix symbol insertion in `transplantSymbolsAtOffset` (PR #120737)

Carlo Cabrera via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 21 05:57:18 PST 2024


================
@@ -91,6 +97,11 @@ static void transplantSymbolsAtOffset(InputSection *fromIsec,
     }
     return true;
   });
+  assert(llvm::is_sorted(toIsec->symbols,
+                         [](const Defined *s, const Defined *t) {
+                           return s->value < t->value;
+                         }) &&
+         "Symbols should still be sorted at exit.");
----------------
carlocab wrote:

I'll probably get rid of this one, since I can't get it to fire. My theory is that the failure of this assertion can only be a consequence of UB, so the compiler just optimises this away. (No real evidence to support this though, so could be wrong!)

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


More information about the llvm-commits mailing list