[lld] r287788 - Re-commit r287727: Use SHA1::hash and MD5::hash functions.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 10:11:38 PST 2016


Author: ruiu
Date: Wed Nov 23 12:11:38 2016
New Revision: 287788

URL: http://llvm.org/viewvc/llvm-project?rev=287788&view=rev
Log:
Re-commit r287727: Use SHA1::hash and MD5::hash functions.

r287727 was not a change that broke buildbots; the other change
(r287726) that I made to LLVM broke them.

Modified:
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=287788&r1=287787&r2=287788&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed Nov 23 12:11:38 2016
@@ -359,18 +359,12 @@ void BuildIdSection<ELFT>::writeBuildId(
     break;
   case BuildIdKind::Md5:
     computeHash(Buf, [](uint8_t *Dest, ArrayRef<uint8_t> Arr) {
-      MD5 Hash;
-      Hash.update(Arr);
-      MD5::MD5Result Res;
-      Hash.final(Res);
-      memcpy(Dest, Res, 16);
+      memcpy(Dest, MD5::hash(Arr).data(), 16);
     });
     break;
   case BuildIdKind::Sha1:
     computeHash(Buf, [](uint8_t *Dest, ArrayRef<uint8_t> Arr) {
-      SHA1 Hash;
-      Hash.update(Arr);
-      memcpy(Dest, Hash.final().data(), 20);
+      memcpy(Dest, SHA1::hash(Arr).data(), 20);
     });
     break;
   case BuildIdKind::Uuid:




More information about the llvm-commits mailing list