Index: lld/MachO/SyntheticSections.cpp =================================================================== --- lld/MachO/SyntheticSections.cpp +++ lld/MachO/SyntheticSections.cpp @@ -23,10 +23,14 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/LEB128.h" #include "llvm/Support/Path.h" -#include "llvm/Support/SHA256.h" #if defined(__APPLE__) #include + +#define COMMON_DIGEST_FOR_OPENSSL +#include +#else +#include "llvm/Support/SHA256.h" #endif #ifdef LLVM_HAVE_LIBXAR @@ -45,10 +49,16 @@ // Reads `len` bytes at data and writes the 32-byte SHA256 checksum to `output`. static void sha256(const uint8_t *data, size_t len, uint8_t *output) { +#if defined(__APPLE__) + // FIXME: Make LLVM's SHA256 faster and use it unconditionally. See PR56121 + // for some notes on this. + CC_SHA256(data, len, output); +#else ArrayRef block(data, len); std::array hash = SHA256::hash(block); assert(hash.size() == CodeSignatureSection::hashSize); memcpy(output, hash.data(), hash.size()); +#endif } InStruct macho::in;