Skip to content

gh-102204: Fix endianness issue in AIX #102206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 3 additions & 2 deletions Modules/_hacl/include/krml/lowstar_endianness.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down