================
@@ -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.
----------------
clayborg wrote:
Byte size of zero isn't always SHT_NOBITS. You might want to check the section
type to see if it is `eSectionTypeZeroFill` instead of looking for a byte size
of zero. Looking at the ObjectFileELF we can see:
```
SectionType ObjectFileELF::GetSectionType(const ELFSectionHeaderInfo &H) const {
switch (H.sh_type) {
case SHT_PROGBITS:
if (H.sh_flags & SHF_EXECINSTR)
return eSectionTypeCode;
break;
case SHT_NOBITS:
if (H.sh_flags & SHF_ALLOC)
return eSectionTypeZeroFill;
break;
...
```
Also, both sections might be zero filled, so we want to take the `lhs` in that
case.
https://github.com/llvm/llvm-project/pull/166635
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits