From: Jez Ng Date: Fri, 10 Sep 2021 21:00:43 +0000 (-0400) Subject: [lld-macho][nfc] Don't mix file sizes with addresses X-Git-Tag: upstream/15.0.7~12692 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9c2363048b00749561070008d3b696438ee1024;p=platform%2Fupstream%2Fllvm.git [lld-macho][nfc] Don't mix file sizes with addresses Update DataInCode's calculation of `endAddr` to use `getSize()` instead of `getFileSize()` -- while in practice they're the same for non-zerofill sections (which code sections are), we still should treat address sizes / offsets as distinct from file sizes / offsets. --- diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp index ccd4f90..e47c7e3 100644 --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -770,7 +770,7 @@ static std::vector collectDataInCodeEntries() { [](const MachO::data_in_code_entry &entry, uint64_t addr) { return entry.offset < addr; }); - const uint64_t endAddr = beginAddr + isec->getFileSize(); + const uint64_t endAddr = beginAddr + isec->getSize(); for (const auto end = entries.end(); it != end && it->offset + it->length <= endAddr; ++it) dataInCodeEntries.push_back(