diff options
Diffstat (limited to 'lld/MachO/BPSectionOrderer.cpp')
| -rw-r--r-- | lld/MachO/BPSectionOrderer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp index 1f07ea9..d50abc2 100644 --- a/lld/MachO/BPSectionOrderer.cpp +++ b/lld/MachO/BPSectionOrderer.cpp @@ -61,12 +61,13 @@ struct BPOrdererMachO : lld::BPOrderer<BPOrdererMachO> { // Calculate relocation hashes for (const auto &r : sec.relocs) { - if (r.length == 0 || r.referent.isNull() || r.offset >= data.size()) + uint32_t relocLength = 1 << r.length; + if (r.referent.isNull() || r.offset + relocLength > data.size()) continue; uint64_t relocHash = getRelocHash(r, sectionToIdx); uint32_t start = (r.offset < windowSize) ? 0 : r.offset - windowSize + 1; - for (uint32_t i = start; i < r.offset + r.length; i++) { + for (uint32_t i = start; i < r.offset + relocLength; i++) { auto window = data.drop_front(i).take_front(windowSize); hashes.push_back(xxh3_64bits(window) ^ relocHash); } |
