10000 [3.12] gh-89640: harden float word ordering (#125571 and #126387) (#1… · python/cpython@b00887d · GitHub
[go: up one dir, main page]

Skip to content

Commit b00887d

Browse files
[3.12] gh-89640: harden float word ordering (#125571 and #126387) (#126430)
Properly detect float word ordering on Linux (gh-125571) autoconf-archive patch by Dan Amelang. (cherry picked from commit 26d6277) Hardcode WASM float word ordering to little endian (gh-126387) (cherry picked from commit 532fc08)
1 parent 786886a commit b00887d

File tree

8 files changed

+114
-66
lines changed

8 files changed

+114
-66
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
9898
runs-on: ubuntu-24.04
9999
container:
100-
image: ghcr.io/python/autoconf:2024.10.11.11293396815
100+
image: ghcr.io/python/autoconf:2024.10.16.11360930377
101101
timeout-minutes: 60
102102
needs: check_source
103103
if: needs.check_source.outputs.run_tests == 'true'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve detection of float word ordering on Linux when link-time optimizations
2+
are enabled.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hard-code float word ordering as little endian on WASM.

Tools/build/regen-configure.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e -x
55
# The check_generated_files job of .github/workflows/build.yml must kept in
6< 10000 /code>6
# sync with this script. Use the same container image than the job so the job
77
# doesn't need to run autoreconf in a container.
8-
IMAGE="ghcr.io/python/autoconf:2024.10.06.11200919239"
8+
IMAGE="ghcr.io/python/autoconf:2024.10.16.11360930377"
99
AUTORECONF="autoreconf -ivf -Werror"
1010

1111
WORK_DIR="/src"

aclocal.m4

Lines changed: 55 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure

Lines changed: 34 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5679,28 +5679,26 @@ AS_VAR_IF([ac_cv_gcc_asm_for_x64], [yes], [
56795679
# * Check for various properties of floating point *
56805680
# **************************************************
56815681

5682-
AX_C_FLOAT_WORDS_BIGENDIAN
5683-
if test "$ax_cv_c_float_words_bigendian" = "yes"
5684-
then
5685-
AC_DEFINE([DOUBLE_IS_BIG_ENDIAN_IEEE754], [1],
5686-
[Define if C doubles are 64-bit IEEE 754 binary format, stored
5687-
with the most significant byte first])
5688-
elif test "$ax_cv_c_float_words_bigendian" = "no"
5689-
then
5690-
AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1],
5691-
[Define if C doubles are 64-bit IEEE 754 binary format, stored
5692-
with the least significant byte first])
5693-
else
5694-
# Some ARM platforms use a mixed-endian representation for doubles.
5695-
# While Python doesn't currently have full support for these platforms
5696-
# (see e.g., issue 1762561), we can at least make sure that float <-> string
5697-
# conversions work.
5698-
# FLOAT_WORDS_BIGENDIAN doesn't actually detect this case, but if it's not big
5699-
# or little, then it must be this?
5700-
AC_DEFINE([DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754], [1],
5701-
[Define if C doubles are 64-bit IEEE 754 binary format, stored
5702-
in ARM mixed-endian order (byte order 45670123)])
5703-
fi
5682+
AX_C_FLOAT_WORDS_BIGENDIAN(
5683+
[AC_DEFINE([DOUBLE_IS_BIG_ENDIAN_IEEE754], [1],
5684+
[Define if C doubles are 64-bit IEEE 754 binary format,
5685+
stored with the most significant byte first])],
5686+
[AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1],
5687+
[Define if C doubles are 64-bit IEEE 754 binary format,
5688+
stored with the least significant byte first])],
5689+
[AS_CASE([$host_cpu],
5690+
[*arm*], [# Some ARM platforms use a mixed-endian representation for
5691+
# doubles. While Python doesn't currently have full support
5692+
# for these platforms (see e.g., issue 1762561), we can at
5693+
# least make sure that float <-> string conversions work.
5694+
# FLOAT_WORDS_BIGENDIAN doesn't actually detect this case,
5695+
# but if it's not big or little, then it must be this?
5696+
AC_DEFINE([DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754], [1],
5697+
[Define if C doubles are 64-bit IEEE 754 binary format,
5698+
stored in ARM mixed-endian order (byte order 45670123)])],
5699+
[wasm*], [AC_DEFINE([DOUBLE_IS_LITTLE_ENDIAN_IEEE754], [1],
5700+
[Define if C doubles are 64-bit IEEE 754 binary format,
5701+
stored with the least significant byte first])])])
57045702

57055703
# The short float repr introduced in Python 3.1 requires the
57065704
# correctly-rounded string <-> double conversion functions from

pyconfig.h.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
/* Define if --enable-ipv6 is specified */
4848
#undef ENABLE_IPV6
4949

50-
/* Define to 1 if your system stores words within floats with the most
51-
significant word first */
52-
#undef FLOAT_WORDS_BIGENDIAN
53-
5450
/* Define if getpgrp() must be called as getpgrp(0). */
5551
#undef GETPGRP_HAVE_ARG
5652

0 commit comments

Comments
 (0)
0