aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine/RuntimeDyld
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-08-20 09:27:31 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-08-20 09:27:31 +0000
commit74e81aae7c07b0619a77a5a0a56fdb954ce4b8fd (patch)
tree5588f137289c8e989627f38e478f7647564c2004 /lib/ExecutionEngine/RuntimeDyld
parent6ef333501eb917cbd79a51c84294051a1a257a0b (diff)
downloadexternal_llvm-74e81aae7c07b0619a77a5a0a56fdb954ce4b8fd.zip
external_llvm-74e81aae7c07b0619a77a5a0a56fdb954ce4b8fd.tar.gz
external_llvm-74e81aae7c07b0619a77a5a0a56fdb954ce4b8fd.tar.bz2
memcmp is not a valid way to compare structs with padding in them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld')
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
index 77e2562..11f77fe 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
+++ b/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;
}
};