From 0bccd2d7e777ab5bd758b5e07e1917872876660d Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Thu, 2 Oct 2025 15:00:56 -0500 Subject: [PATCH v1 1/1] disallow big endian on aarch64 --- configure | 7 +++++++ configure.ac | 7 +++++++ meson.build | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/configure b/configure index 22cd866147b..249474ac891 100755 --- a/configure +++ b/configure @@ -14999,6 +14999,13 @@ _ACEOF fi +# AArch64 is bi-endian, but we require little +if test x"$host_cpu" = x"aarch64"; then + if test x"$ac_cv_c_bigendian" = x"yes"; then + as_fn_error $? "big endian is not supported for aarch64" "$LINENO" 5 + fi +fi + # MSVC doesn't cope well with defining restrict to __restrict, the # spelling it understands, because it conflicts with # __declspec(restrict). Therefore we define pg_restrict to the diff --git a/configure.ac b/configure.ac index e44943aa6fe..5b95a0adf5c 100644 --- a/configure.ac +++ b/configure.ac @@ -1685,6 +1685,13 @@ PGAC_UNION_SEMUN AC_CHECK_TYPES(socklen_t, [], [], [#include ]) PGAC_STRUCT_SOCKADDR_SA_LEN +# AArch64 is bi-endian, but we require little +if test x"$host_cpu" = x"aarch64"; then + if test x"$ac_cv_c_bigendian" = x"yes"; then + AC_MSG_ERROR([big endian is not supported for aarch64]) + fi +fi + # MSVC doesn't cope well with defining restrict to __restrict, the # spelling it understands, because it conflicts with # __declspec(restrict). Therefore we define pg_restrict to the diff --git a/meson.build b/meson.build index 395416a6060..35f2580d8ef 100644 --- a/meson.build +++ b/meson.build @@ -1731,6 +1731,10 @@ endif ############################################################### if host_machine.endian() == 'big' + # AArch64 is bi-endian, but we require little + if host_cpu == 'aarch64' + error('big endian is not supported for aarch64') + endif cdata.set('WORDS_BIGENDIAN', 1) endif -- 2.39.5 (Apple Git-154)