diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-08-20 09:27:31 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-08-20 09:27:31 +0000 |
commit | 5a71250113f04df1a2ebea204ad141d94e80d046 (patch) | |
tree | 2ef53f4d078caa21cb7c3e2f590e09ac7285d880 /llvm/lib/ExecutionEngine | |
parent | f2a0f1d133115ebe1c85f68e893406a2b165a5ac (diff) | |
download | bcm5719-llvm-5a71250113f04df1a2ebea204ad141d94e80d046.tar.gz bcm5719-llvm-5a71250113f04df1a2ebea204ad141d94e80d046.zip |
memcmp is not a valid way to compare structs with padding in them.
llvm-svn: 188778
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h index 77e25626d2b..11f77febd5f 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h @@ -123,10 +123,17 @@ public: RelocationValueRef(): SectionID(0), Offset(0), Addend(0), SymbolName(0) {} inline bool operator==(const RelocationValueRef &Other) const { - return std::memcmp(this, &Other, sizeof(RelocationValueRef)) == 0; + return SectionID == Other.SectionID && Offset == Other.Offset && + Addend == Other.Addend && SymbolName == Other.SymbolName; } inline bool operator <(const RelocationValueRef &Other) const { - return std::memcmp(this, &Other, sizeof(RelocationValueRef)) < 0; + if (SectionID != Other.SectionID) + return SectionID < Other.SectionID; + if (Offset != Other.Offset) + return Offset < Other.Offset; + if (Addend != Other.Addend) + return Addend < Other.Addend; + return SymbolName < Other.SymbolName; } }; |