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

Carlo Cabrera via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 21 07:09:28 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've verified that `is_partitioned` triggers _with_ expensive checks with Clang, and _without_ expensive checks with GCC.

The failing tests (for both) are
```
Failed Tests (3):
  lld :: MachO/local-alias-to-weak.s
  lld :: MachO/symtab.s
  lld :: MachO/weak-definition-gc.s
```

I haven't yet verified the assertion failure for Clang without expensive checks. The build is running now; I'll report back soon.

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


More information about the llvm-commits mailing list