[Lldb-commits] [lldb] [LLDB] Fix debuginfo ELF files overwriting Unified Section List (PR #166635)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 5 13:35:34 PST 2025


================
@@ -130,6 +130,42 @@ class ELFRelocation {
 
   RelocUnion reloc;
 };
+
+lldb::SectionSP MergeSections(lldb::SectionSP lhs, lldb::SectionSP rhs) {
+  assert(lhs && rhs);
+
+  // We only take the RHS is the LHS is SHT_NOBITS, which would be
+  // represented as a size of 0. Where we can take the rhs.
+  if (lhs->GetByteSize() == 0)
----------------
clayborg wrote:

Check for `rhs` being zero filled first:
```
if (rhs->GetType() == eSectionTypeZeroFill)
  return lhs; // Keep old section if rhs is zero filled
if (lhs->GetType() == eSectionTypeZeroFill)
  return rhs;
```

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


More information about the lldb-commits mailing list