git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] sha1dc: update from my PR #36

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 27, 2017, 15:22 UTC
Message-ID
<xmqqmv8t317c.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170627121718.12078-2-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> Update sha1dc from my PR #36[1] which'll hopefully be integrated by
> upstream soon.

Please be careful about the title of the patch. "log --oneline" does not even let you tell your readers who calls this as "my" change, and readers would be clueless what PR #36 is. Something like

    sha1dc: correct endian detection for Solaris
may give us more relevant information in the oneline output.
Show 11 quoted lines
> @@ -23,6 +23,13 @@
>  #include "sha1.h"
>  #include "ubc_check.h"
>  
> +#if (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \
> +     defined(i386) || defined(__i386) || defined(__i386__) || defined(__i486__)  || \
> +     defined(__i586__) || defined(__i686__) || defined(_M_IX86) || defined(__X86__) || \
> +     defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__) || \
> +     defined(__386) || defined(_M_X64) || defined(_M_AMD64))
> +#define SHA1DC_ON_INTEL_LIKE_PROCESSOR
> +#endif
It is good that you made this orthogonal to the rest.
Show 12 quoted lines
> +#else /* Not under GCC-alike */
>  
> +#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN)
> +/*
> + * Should detect Big Endian under glibc.git since 14245eb70e ("entered
> + * into RCS", 1992-11-25). Defined in <endian.h> which will have been
> + * brought in by standard headers. See glibc.git and
> + * https://sourceforge.net/p/predef/wiki/Endianness/
> + */
> +#if __BYTE_ORDER == __BIG_ENDIAN
>  #define SHA1DC_BIGENDIAN
>  #endif

Note that this part of the file considers it a valid way for a platform to define a constant BIG_ENDIAN that can be compared to BYTE_ORDER to determine the endianness, implying that such a scheme would also define LITTLE_ENDIAN and a port of such a platform to a little endian box will still _define_ the constant BIG_ENDIAN; it aill have BYTE_ORDER defined to the same value as LITTLE_ENDIAN, though.

Show 9 quoted lines
> +#if (defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
>       defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \
>       defined(__sparc))
> +/*
> + * Should define Big Endian for a whitelist of known processors. See
> + * https://sourceforge.net/p/predef/wiki/Endianness/ and
> + * http://www.oracle.com/technetwork/server-storage/solaris/portingtosolaris-138514.html
> + */
>  #define SHA1DC_BIGENDIAN
These look sensible.
Show 17 quoted lines
> +#else /* Not under GCC-alike or glibc or <processor whitelist> */
> +
> +#if defined(SHA1DC_ON_INTEL_LIKE_PROCESSOR)
> +/*
> + * As a last resort before we fall back on _BIG_ENDIAN or whatever
> + * else we're not 100% sure about below, we blacklist specific
> + * processors here. We could add more, see
> + * e.g. https://wiki.debian.org/ArchitectureSpecificsMemo
> + */
> +#else /* Not under GCC-alike or glibc or <processor whitelist>  or <processor blacklist> */
> +
> +#ifdef _BIG_ENDIAN
> +/*
> + * Solaris / illumos defines either _LITTLE_ENDIAN or _BIG_ENDIAN in
> + * <sys/isa_defs.h>.
> + */
> +#define SHA1DC_BIGENDIAN

This makes readers of this patch wonder why we assume platforms won't define _LITTLE_ENDIAN and _BIG_ENDIAN at the same time, just like we saw in the section with __BIG_ENDIAN above.

Thanks, but this is starting to feel like watching a whack-a-mole played while blindfolded. At some point, somebody upstream should declare that enough is enough and introduce the "SHA1DC_FORCE_ENDIAN" macro.

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 4 of 50 in “Compile Error v2.13.2 on Solaris SPARC”
  1. Michael KebeJun 26, 2017
  2. 0/3 update sha1dc from PR #36Ævar Arnfjörð Bjarmason, Jun 27, 2017
  3. 1/3 sha1dc: update from my PR #36Ævar Arnfjörð Bjarmason, Jun 27, 2017
  4. Junio C HamanoJun 27, 2017
  5. Junio C HamanoJun 27, 2017
  6. Ævar Arnfjörð BjarmasonJun 27, 2017
  7. Junio C HamanoJun 27, 2017
  8. Liam R. HowlettJun 27, 2017
  9. Ævar Arnfjörð BjarmasonJun 27, 2017
  10. Junio C HamanoJun 27, 2017
  11. Junio C HamanoJun 27, 2017
  12. Ævar Arnfjörð BjarmasonJun 27, 2017
  13. Junio C HamanoJun 27, 2017
  14. Liam R. HowlettJun 27, 2017
  15. Junio C HamanoJun 27, 2017
  16. Ævar Arnfjörð BjarmasonJun 27, 2017
  17. Junio C HamanoJun 27, 2017
  18. Ævar Arnfjörð BjarmasonJun 27, 2017
  19. Junio C HamanoJun 27, 2017
  20. Junio C HamanoJun 27, 2017
  21. Ævar Arnfjörð BjarmasonJun 27, 2017
  22. 2/3 sha1dc: optionally use sha1collisiondetection as a submoduleÆvar Arnfjörð Bjarmason, Jun 27, 2017
  23. Stefan BellerJun 27, 2017
  24. Ævar Arnfjörð BjarmasonJun 27, 2017
  25. 3/3 sha1collisiondetection: automatically enable when submodule is populatedÆvar Arnfjörð Bjarmason, Jun 27, 2017
  26. Stefan BellerJun 27, 2017
  27. 0/3 Update sha1dc from upstreamÆvar Arnfjörð Bjarmason, Jul 1, 2017
  28. 2/3 sha1dc: optionally use sha1collisiondetection as a submoduleÆvar Arnfjörð Bjarmason, Jul 1, 2017
  29. Junio C HamanoJul 3, 2017
  30. Ævar Arnfjörð BjarmasonJul 3, 2017
  31. Junio C HamanoJul 4, 2017
  32. Ævar Arnfjörð BjarmasonJul 4, 2017
  33. Stefan BellerJul 5, 2017
  34. Junio C HamanoJul 5, 2017
  35. Stefan BellerJul 5, 2017
  36. Ævar Arnfjörð BjarmasonJul 5, 2017
  37. 1/3 sha1dc: update from upstreamÆvar Arnfjörð Bjarmason, Jul 1, 2017
  38. 3/3 sha1collisiondetection: automatically enable when submodule is populatedÆvar Arnfjörð Bjarmason, Jul 1, 2017
  39. Michael KebeJun 26, 2017
  40. Ævar Arnfjörð BjarmasonJun 26, 2017
  41. Michael KebeJun 26, 2017
  42. Ævar Arnfjörð BjarmasonJun 26, 2017
  43. Liam R. HowlettJun 26, 2017
  44. Michael KebeJun 27, 2017
  45. Michael KebeJun 27, 2017
  46. Liam R. HowlettJun 27, 2017
  47. Junio C HamanoJun 27, 2017
  48. Liam R. HowlettJun 27, 2017
  49. Ævar Arnfjörð BjarmasonJun 27, 2017
  50. Ævar Arnfjörð BjarmasonJun 27, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.