gh-89640: Hardcode WASM float word ordering as little endian (#126387)

This commit is contained in:
Erlend E. Aasland 2024-11-04 21:48:09 +01:00 committed by GitHub
parent 9b7294c3a5
commit 532fc08102
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 41 additions and 53 deletions

View File

@ -0,0 +1 @@
Hard-code float word ordering as little endian on WASM.

45
configure generated vendored
View File

@ -24227,41 +24227,34 @@ printf "%s\n" "$ax_cv_c_float_words_bigendian" >&6; }
case $ax_cv_c_float_words_bigendian in case $ax_cv_c_float_words_bigendian in
yes) yes)
printf "%s\n" "#define FLOAT_WORDS_BIGENDIAN 1" >>confdefs.h printf "%s\n" "#define DOUBLE_IS_BIG_ENDIAN_IEEE754 1" >>confdefs.h
;; ;;
no) no)
printf "%s\n" "#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1" >>confdefs.h
;; ;;
*) *)
as_fn_error $? " case $host_cpu in #(
*arm*) :
# Some ARM platforms use a mixed-endian representation for
# doubles. While Python doesn't currently have full support
# for these platforms (see e.g., issue 1762561), we can at
# least make sure that float <-> string conversions work.
# FLOAT_WORDS_BIGENDIAN doesn't actually detect this case,
# but if it's not big or little, then it must be this?
Unknown float word ordering. You need to manually preset printf "%s\n" "#define DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 1" >>confdefs.h
ax_cv_c_float_words_bigendian=no (or yes) according to your system. ;; #(
wasm*) :
" "$LINENO" 5 ;; printf "%s\n" "#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1" >>confdefs.h
;; #(
*) :
;;
esac ;;
esac esac
if test "$ax_cv_c_float_words_bigendian" = "yes"
then
printf "%s\n" "#define DOUBLE_IS_BIG_ENDIAN_IEEE754 1" >>confdefs.h
elif test "$ax_cv_c_float_words_bigendian" = "no"
then
printf "%s\n" "#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1" >>confdefs.h
else
# Some ARM platforms use a mixed-endian representation for doubles.
# While Python doesn't currently have full support for these platforms
# (see e.g., issue 1762561), we can at least make sure that float <-> string
# conversions work.
# FLOAT_WORDS_BIGENDIAN doesn't actually detect this case, but if it's not big
# or little, then it must be this?
printf "%s\n" "#define DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 1" >>confdefs.h
fi
# The short float repr introduced in Python 3.1 requires the # The short float repr introduced in Python 3.1 requires the
# correctly-rounded string <-> double conversion functions from # correctly-rounded string <-> double conversion functions from

View File

@ -5946,28 +5946,26 @@ AS_VAR_IF([ac_cv_gcc_asm_for_x64], [yes], [
# * Check for various properties of floating point * # * Check for various properties of floating point *
# ************************************************** # **************************************************
AX_C_FLOAT_WORDS_BIGENDIAN AX_C_FLOAT_WORDS_BIGENDIAN(
if test "$ax_cv_c_float_words_bigendian" = "yes" [AC_DEFINE([DOUBLE_IS_BIG_ENDIAN_IEEE754], [1],
then [Define if C doubles are 64-bit IEEE 754 binary format,
AC_DEFINE([DOUBLE_IS_BIG_ENDIAN_IEEE754], [1], stored with the most significant byte first])],
[Define if C doubles are 64-bit IEEE 754 binary format, stored [AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1],
with the most significant byte first]) [Define if C doubles are 64-bit IEEE 754 binary format,
elif test "$ax_cv_c_float_words_bigendian" = "no" stored with the least significant byte first])],
then [AS_CASE([$host_cpu],
AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1], [*arm*], [# Some ARM platforms use a mixed-endian representation for
[Define if C doubles are 64-bit IEEE 754 binary format, stored # doubles. While Python doesn't currently have full support
with the least significant byte first]) # for these platforms (see e.g., issue 1762561), we can at
else # least make sure that float <-> string conversions work.
# Some ARM platforms use a mixed-endian representation for doubles. # FLOAT_WORDS_BIGENDIAN doesn't actually detect this case,
# While Python doesn't currently have full support for these platforms # but if it's not big or little, then it must be this?
# (see e.g., issue 1762561), we can at least make sure that float <-> string
# conversions work.
# FLOAT_WORDS_BIGENDIAN doesn't actually detect this case, but if it's not big
# or little, then it must be this?
AC_DEFINE([DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754], [1], AC_DEFINE([DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format, stored [Define if C doubles are 64-bit IEEE 754 binary format,
in ARM mixed-endian order (byte order 45670123)]) stored in ARM mixed-endian order (byte order 45670123)])],
fi [wasm*], [AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1],
[Define if C doubles are 64-bit IEEE 754 binary format,
stored with the least significant byte first])])])
# The short float repr introduced in Python 3.1 requires the # The short float repr introduced in Python 3.1 requires the
# correctly-rounded string <-> double conversion functions from # correctly-rounded string <-> double conversion functions from

View File

@ -47,10 +47,6 @@
/* Define if --enable-ipv6 is specified */ /* Define if --enable-ipv6 is specified */
#undef ENABLE_IPV6 #undef ENABLE_IPV6
/* Define to 1 if your system stores words within floats with the most
significant word first */
#undef FLOAT_WORDS_BIGENDIAN
/* Define if getpgrp() must be called as getpgrp(0). */ /* Define if getpgrp() must be called as getpgrp(0). */
#undef GETPGRP_HAVE_ARG #undef GETPGRP_HAVE_ARG