================
@@ -1697,6 +1701,14 @@ void ObjectFileMachO::ProcessSegmentCommand(
// isn't stored in the abstracted Sections.
m_mach_sections.push_back(sect64);
+ // Make sure we can load dSYM files whose __DWARF sections exceed the 4GB
+ // barrier. llvm::MachO::section_64 have only 32 bit file offsets for the
+ // section contents.
+ const uint64_t section_file_offset = sect64.offset + section_offset_adjust;
+ // If this section overflows a 4GB barrier, then we need to adjust any
+ // subsequent the section offsets.
+ if (is_dsym && ((uint64_t)sect64.offset + sect64.size) >= UINT32_MAX)
+ section_offset_adjust += 0x100000000ull;
----------------
ellishg wrote:
Right, I think this won't work if the section size is > 8GB, which is not the
case in your examples (I know the example is contrived, but not impossible). If
the offset + size spills over 4GB, then we need to add `0x100000000ull` like we
do here. We can see file offset of `__debug_aranges ` is `0x17705c6fb ` rather
than `0x7705c6fb `. But imagine if the size of the prior section `__debug_info`
was 4GB larger. Then we would need to add `0x200000000ull` to the file offset
of the next section `__debug_aranges` to get `0x27705c6fb`.
In the code, we don't just want to add `0x100000000ull`, we want to add
`0x100000000ull * N` where N is the number of 4GB boundaries that the section
crosses. That is basically the math I was attempting to do with the bit mask.
https://github.com/llvm/llvm-project/pull/164471
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits