Title: Don't use AC_RUN_IFELSE to determine float endian
Type: Stage: resolved
Components: Build Versions: Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, mark.dickinson, rossburton, tim.peters, yan12125
Priority: normal Keywords: patch

Created on 2018-09-05 10:57 by rossburton, last changed 2018-09-19 06:49 by benjamin.peterson. This issue is now closed.

File name Uploaded Description Edit
0001-Don-t-do-runtime-test-to-get-float-byte-order.patch rossburton, 2018-09-05 10:57
Pull Requests
URL Status Linked Edit
PR 9085 merged rossburton, 2018-09-06 22:54
Messages (3)
msg324627 - (view) Author: Ross Burton (rossburton) * Date: 2018-09-05 10:57
Currently uses AC_RUN_IFELSE to determine the byte order of floats and doubles.  This hurts when cross-compiling because a default is set, resulting in Python silently falling back to sub-optimal codepaths.

A partial improvement would be to not set a fallback, to force the user to set the right byte order explicitly.

However this test can be done without running anything.  autoconf-archive has a macro that uses a carefully constructed double that encodes to an ASCII string in the binary, which is then examined using grep.  Evil genius.

Attached is a POC using this.  Currently the autoconf-archive macro only handles big and little endian not the ARM OABI mixed-endian format, so assumes if the byte order is unknown then it's the crazy mixed-endian.

To be honest OABI is so old now, I don't believe anyone actually uses it anymore: everyone still on ARMv4 should have moved to EABI many years ago, and the mixed-endian support could be removed from Py3 in the future.
msg325705 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-09-19 06:25
New changeset 2a9c3805ddedf282881ef7811a561c70b74f80b1 by Benjamin Peterson (Ross Burton) in branch 'master':
closes bpo-34585: Don't do runtime test to get float byte order. (GH-9085)
msg325708 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-09-19 06:49
New changeset b3b8cb419e496629873fa7dda82a01863f58617a by Benjamin Peterson in branch 'master':
run autoconf (GH-9411)
Date User Action Args
2018-09-19 06:49:08benjamin.petersonsetmessages: + msg325708
2018-09-19 06:25:56benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg325705

resolution: fixed
stage: patch review -> resolved
2018-09-13 15:06:59ned.deilysetnosy: + tim.peters, mark.dickinson
2018-09-07 05:37:01yan12125setnosy: + yan12125
2018-09-06 22:54:53rossburtonsetstage: patch review
pull_requests: + pull_request8543
2018-09-05 10:57:22rossburtoncreate