Hi,
In 3.0.1, this endianness test was broken:
--8<--
#ifndef LITTLE_ENDIAN
/* swap endianness */
static uint32_t swap(uint32_t x)
{
#if defined(__GNUC__) || defined(__clang__)
return __builtin_bswap32(x);
#else
return (x >> 24) |
((x >> 8) & 0x0000FF00) |
((x << 8) & 0x00FF0000) |
(x << 24);
#endif
}
#endif
-->8--
LITTLE_ENDIAN is always defined since we include endian.h. This was
fixed in 3.0.2:
--8<--
#if BYTE_ORDER != LITTLE_ENDIAN
/* swap endianness */
static uint32_t swap(uint32_t x)
{
#if defined(__GNUC__) || defined(__clang__)
return __builtin_bswap32(x);
#else
return (x >> 24) |
((x >> 8) & 0x0000FF00) |
((x << 8) & 0x00FF0000) |
(x << 24);
#endif
}
#endif
-->8--
Which results in the following error:
http://build-failures.rhaalovely.net//sparc64/2017-06-22/mail/cyrus-imapd.log
AFAICS gcc-4.2.1 doesn't have __builtin_bswap32, looks like it was added
for 4.3. A proper autoconf check could be better here but I wanted to
avoid too much churn.
I plan to test this on sparc64 when cvs up completes... ok?
Index: patches/patch-lib_crc32_c
===================================================================
RCS file: patches/patch-lib_crc32_c
diff -N patches/patch-lib_crc32_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_crc32_c 13 Jul 2017 09:56:08 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+gcc-4.2.1 doesn't have __builtin_bswap32
+
+Index: lib/crc32.c
+--- lib/crc32.c.orig
++++ lib/crc32.c
+@@ -615,7 +615,7 @@ static const uint32_t crc32_lookup[16][256] =
+ /* swap endianness */
+ static uint32_t swap(uint32_t x)
+ {
+-#if defined(__GNUC__) || defined(__clang__)
++#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__
>= 3))) || defined(__clang__)
+ return __builtin_bswap32(x);
+ #else
+ return (x >> 24) |
Index: patches/patch-lib_crc32c_c
===================================================================
RCS file: patches/patch-lib_crc32c_c
diff -N patches/patch-lib_crc32c_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_crc32c_c 13 Jul 2017 09:56:13 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+gcc-4.2.1 doesn't have __builtin_bswap32
+
+Index: lib/crc32c.c
+--- lib/crc32c.c.orig
++++ lib/crc32c.c
+@@ -595,7 +595,7 @@ static const uint32_t crc32c_lookup[4][256] = {
+ /* swap endianness */
+ static uint32_t swap(uint32_t x)
+ {
+-#if defined(__GNUC__) || defined(__clang__)
++#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__
>= 3))) || defined(__clang__)
+ return __builtin_bswap32(x);
+ #else
+ return (x >> 24) |
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE