[lld] Fix lld crash wrt generated thunks growing away from the patched code (PR #170495)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 08:56:22 PST 2025


================
@@ -48,6 +48,11 @@ bool elf::isAArch64BTILandingPad(Ctx &ctx, Symbol &s, int64_t a) {
   if (off >= isec->getSize())
     return true;
   const uint8_t *buf = isec->content().begin();
+  // Synthetic sections may have a size but empty data - Assume that they won't contain a landing pad
+  if (buf == nullptr && dyn_cast<SyntheticSection>(isec) != nullptr) {
----------------
smithp35 wrote:

LLD coding style is to omit the braces for a single statement. You can also use `isa<SyntheticSection>` as a simpler form of `dyn_cast<SyntheticSection>(isec) != nullptr)`

```
if (buf == nullptr && !isa<SyntheticSection>(isec))
  return false;
```

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


More information about the llvm-commits mailing list