All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Free via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Alex Free <alex_free@email.com>, alex <you@example.com>
Subject: [PATCH] fix gcc 4.0 big endian sha1
Date: Sun, 01 Nov 2020 11:42:16 +0000	[thread overview]
Message-ID: <pull.907.git.git.1604230936338.gitgitgadget@gmail.com> (raw)

From: alex <you@example.com>

The 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.

This 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.

Signed-off-by: Alex Free <alex_free@email.com>
---
    fix gcc 4.0 big endian sha1
    
    Currently, sha1.c is compiled in little endian mode when using gcc 4.0
    on Mac OS X 10.4 PowerPC (which is big endian). This results in a build
    that always states there is a sha1 mismatch. The below patch allows big
    endian to be detected correctly using GCC 4.0 and probably older
    versions as well.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-907%2Falex-free%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-907/alex-free/master-v1
Pull-Request: https://github.com/git/git/pull/907

 sha1dc/sha1.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
index dede2cbddf..4899ffcc20 100644
--- a/sha1dc/sha1.c
+++ b/sha1dc/sha1.c
@@ -43,6 +43,14 @@
    you will have to add whatever macros your tool chain defines to indicate Big-Endianness.
  */
 
+#if defined(__BIG_ENDIAN__)
+#define SHA1DC_BIGENDIAN
+#endif
+
+/*
+   Required for GCC 4.0
+*/
+
 #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
 /*
  * Should detect Big Endian under GCC since at least 4.6.0 (gcc svn

base-commit: ad27df6a5cff694add500ab8c7f97234feb4a91f
-- 
gitgitgadget

                 reply	other threads:[~2020-11-01 11:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.907.git.git.1604230936338.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=alex_free@email.com \
    --cc=git@vger.kernel.org \
    --cc=you@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.