From 409afcf174fbb503336aac450a42c8aa36aa09ce Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 27 Jul 2013 14:14:43 +0000 Subject: [PATCH] DwarfDebug: MD5 is always little endian, bswap on big endian platforms. This makes LLVM emit the same signature regardless of host and target endianess. llvm-svn: 187304 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 5 +++-- llvm/test/DebugInfo/{X86 => }/generate-odr-hash.ll | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename llvm/test/DebugInfo/{X86 => }/generate-odr-hash.ll (100%) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 0d2d02e..7ba1fc1 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1059,8 +1059,9 @@ static void addDIEODRSignature(MD5 &Hash, CompileUnit *CU, DIE *Die) { Hash.final(Result); // ... take the least significant 8 bytes and store those as the attribute. - uint64_t Signature; - memcpy(&Signature, &Result[8], 8); + // Our MD5 implementation always returns its results in little endian, swap + // bytes appropriately. + uint64_t Signature = *reinterpret_cast(Result + 8); // FIXME: This should be added onto the type unit, not the type, but this // works as an intermediate stage. diff --git a/llvm/test/DebugInfo/X86/generate-odr-hash.ll b/llvm/test/DebugInfo/generate-odr-hash.ll similarity index 100% rename from llvm/test/DebugInfo/X86/generate-odr-hash.ll rename to llvm/test/DebugInfo/generate-odr-hash.ll -- 2.7.4