diff options
Diffstat (limited to 'bolt/lib/Core/BinarySection.cpp')
-rw-r--r-- | bolt/lib/Core/BinarySection.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bolt/lib/Core/BinarySection.cpp b/bolt/lib/Core/BinarySection.cpp index 1e28da4cb2f7..846515c3ed13 100644 --- a/bolt/lib/Core/BinarySection.cpp +++ b/bolt/lib/Core/BinarySection.cpp @@ -39,7 +39,13 @@ BinarySection::hash(const BinaryData &BD, if (Itr != Cache.end()) return Itr->second; - Cache[&BD] = 0; + hash_code Hash = + hash_combine(hash_value(BD.getSize()), hash_value(BD.getSectionName())); + + Cache[&BD] = Hash; + + if (!containsRange(BD.getAddress(), BD.getSize())) + return Hash; uint64_t Offset = BD.getAddress() - getAddress(); const uint64_t EndOffset = BD.getEndAddress() - getAddress(); @@ -47,9 +53,6 @@ BinarySection::hash(const BinaryData &BD, auto End = Relocations.upper_bound(Relocation{EndOffset, 0, 0, 0, 0}); const StringRef Contents = getContents(); - hash_code Hash = - hash_combine(hash_value(BD.getSize()), hash_value(BD.getSectionName())); - while (Begin != End) { const Relocation &Rel = *Begin++; Hash = hash_combine( |