================
@@ -1697,6 +1701,15 @@ void ObjectFileMachO::ProcessSegmentCommand(
     // isn't stored in the abstracted Sections.
     m_mach_sections.push_back(sect64);
 
+    // Make sure we can load sections in mach-o files where some sections cross
+    // a 4GB boundary. llvm::MachO::section_64 have only 32 bit file offsets
+    // for the file offset of the section contents, so we need to track and
+    // sections that overflow and adjust the offsets accordingly.
+    const uint64_t section_file_offset = sect64.offset + section_offset_adjust;
+    const uint64_t end_section_offset = (uint64_t)sect64.offset + sect64.size;
----------------
drodriguez wrote:

The integer promotion rules quick in with that `+`. In the first line `uint32_t 
+ uint64_t`, so the left hand side is promoted to `uint64_t`. In the second 
line it would be `uint32_t + uint64_t` as well if the casting was not there, so 
the left hand would be promoted. The casting is not necessary, but I think it 
leaves clear the author knows what they are doing. I would like the consistency 
of both having or not having the casting, thought.

https://github.com/llvm/llvm-project/pull/164471
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to