diff --git a/Misc/NEWS.d/next/Library/2023-02-24-03-54-39.gh-issue-102204.EV1GPP.rst b/Misc/NEWS.d/next/Library/2023-02-24-03-54-39.gh-issue-102204.EV1GPP.rst new file mode 100644 index 00000000000000..3a43f6c584375c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-02-24-03-54-39.gh-issue-102204.EV1GPP.rst @@ -0,0 +1,3 @@ +AIX doesn't have ``__BYTE_ORDER__`` defined when XLC compiler is used which +breaks ``_hacl`` module build. So define _AIX in the generic big-endian +fallback code. diff --git a/Modules/_hacl/include/krml/lowstar_endianness.h b/Modules/_hacl/include/krml/lowstar_endianness.h index 32a7391e817ebb..d386dfa719e2fe 100644 --- a/Modules/_hacl/include/krml/lowstar_endianness.h +++ b/Modules/_hacl/include/krml/lowstar_endianness.h @@ -95,8 +95,9 @@ # define be64toh(x) __builtin_bswap64(x) # define le64toh(x) (x) -/* ... generic big-endian fallback code */ -#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +/* ... generic big-endian fallback code + ... AIX doesn't have __BYTE_ORDER__ (with XLC compiler) & is always big-endian */ +#elif (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || defined(_AIX) /* byte swapping code inspired by: * https://github.com/rweather/arduinolibs/blob/master/libraries/Crypto/utility/EndianUtil.h