From: Ken Cunningham Date: Thu, 10 May 2018 18:11:44 GMT Subject: bug: SHA1 calculation on PPC machines when built with gcc older than 4.6 Message-ID: <418E3D80-FE0F-436B-B9D1-475E49C4D75D@gmail.com> Some vintage Apple PPC machines build a non-funtional version of git as of git 13.1 when using the stock gcc compilers that are installed with the OS; the SHA1 calculations are faulty. This can be repaired with a simple patch (attached). Stock vintage Apple PPC machines come with gcc-4.0 or gcc-4.2. On MacOS 10.4 and earlier, or when not using Apple Common Crypto on 10.5, git uses the SHA1 calculation code from here . The code in tries to detect all systems that are BIG_ENDIAN, but the above noted systems fall through because they fail the tests. It appears that the primary test: #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) only works as of gcc-4.6 and newer, so the code is built as LITTLE_ENDIAN on PPC with older gcc versions. Issue report: MacPorts bug report: The included patch to git fixes the issue on our testing. Thanks for git! Ken Cunningham ===== diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c index 25eded1..5faf5a5 100644 --- a/sha1dc/sha1.c +++ b/sha1dc/sha1.c @@ -92,6 +92,10 @@ */ #define SHA1DC_BIGENDIAN +#elif (defined(__APPLE__) && defined(__BIG_ENDIAN__) && !defined(SHA1DC_BIGENDIAN)) +/* older gcc compilers which are the default on Apple PPC do not define __BYTE_ORDER__ */ +#define SHA1DC_BIGENDIAN + /* Not under GCC-alike or glibc or *BSD or newlib or */ #elif defined(SHA1DC_ON_INTEL_LIKE_PROCESSOR) /* ==========