git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] fix gcc 4.0 big endian sha1
@ 2020-11-01 11:42 Alex Free via GitGitGadget
  0 siblings, 0 replies; only message in thread
From: Alex Free via GitGitGadget @ 2020-11-01 11:42 UTC (permalink / raw)
  To: git; +Cc: Alex Free, alex

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-01 11:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-01 11:42 [PATCH] fix gcc 4.0 big endian sha1 Alex Free via GitGitGadget

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git