{"thread":{"id":"54548","subject":"[PATCH] fix gcc 4.0 big endian sha1","startedAt":"2020-11-01T11:42:21Z","lastAt":"2020-11-01T11:42:21Z","messageCount":1,"participants":["Alex Free via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"408810","messageId":"pull.907.git.git.1604230936338.gitgitgadget@gmail.com","threadId":"54548","inReplyTo":null,"subject":"[PATCH] fix gcc 4.0 big endian sha1","fromName":"Alex Free via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-11-01T11:42:16Z","receivedAt":"2020-11-01T11:42:21Z","isPatch":true,"sender":{"key":"name:Alex Free","avatar":null},"body":"From: alex <you@example.com>\n\nThe file sha1dc/sha1.c requires big endian to be defined by the compiler. If it is not defined, then it defaults to little endian mode, which when compiled and ran on a big endian machine results in a sha1 mismatch.\n\nThis change will allow git to correctly detect big endian on GCC 4.2 and GCC 4.0 running on PowerPC Mac OS X 10.4 and Mac OS X 10.5, resulting in a successful build that works correctly.\n\nSigned-off-by: Alex Free <alex_free@email.com>\n---\n    fix gcc 4.0 big endian sha1\n    \n    Currently, sha1.c is compiled in little endian mode when using gcc 4.0\n    on Mac OS X 10.4 PowerPC (which is big endian). This results in a build\n    that always states there is a sha1 mismatch. The below patch allows big\n    endian to be detected correctly using GCC 4.0 and probably older\n    versions as well.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-907%2Falex-free%2Fmaster-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-907/alex-free/master-v1\nPull-Request: https://github.com/git/git/pull/907\n\n sha1dc/sha1.c | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/sha1dc/sha1.c b/sha1dc/sha1.c\nindex dede2cbddf..4899ffcc20 100644\n--- a/sha1dc/sha1.c\n+++ b/sha1dc/sha1.c\n@@ -43,6 +43,14 @@\n    you will have to add whatever macros your tool chain defines to indicate Big-Endianness.\n  */\n \n+#if defined(__BIG_ENDIAN__)\n+#define SHA1DC_BIGENDIAN\n+#endif\n+\n+/*\n+   Required for GCC 4.0\n+*/\n+\n #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)\n /*\n  * Should detect Big Endian under GCC since at least 4.6.0 (gcc svn\n\nbase-commit: ad27df6a5cff694add500ab8c7f97234feb4a91f\n-- \ngitgitgadget\n"}]}