* [Buildroot] [PATCH 1/2] python: fix double format detection
@ 2016-11-09 9:25 Jérôme Pouiller
2016-11-09 9:25 ` [Buildroot] [PATCH 2/2] python3: " Jérôme Pouiller
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jérôme Pouiller @ 2016-11-09 9:25 UTC (permalink / raw)
To: buildroot
Python is not able to detect if compiler double representation is
compliant with IEE754:
checking whether C doubles are little-endian IEEE 754 binary64... no
checking whether C doubles are big-endian IEEE 754 binary64... no
checking whether C doubles are ARM mixed-endian IEEE 754 binary64... no
Accordingly 'legacy' mode isused. It is possible to check this at runtime by
check if 'sys.float_repr_style' contains 'short' or 'legacy'. Calculus
correctness is not garanteed with 'legacy'.
Problem is better described here:
http://stackoverflow.com/questions/29920294/what-causes-pythons-float-repr-style-to-use-legacy
https://bugs.python.org/issue7117
However, all gcc architecture use a representation compliant with IEE754. So,
we can enable it unconditionnaly.
Signed-off-by: J?r?me Pouiller <jezz@sysmic.org>
---
package/python/python.mk | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/package/python/python.mk b/package/python/python.mk
index cc65376..0191d59 100644
--- a/package/python/python.mk
+++ b/package/python/python.mk
@@ -140,6 +140,13 @@ PYTHON_CONF_ENV += \
ac_cv_prog_HAS_HG=/bin/false \
ac_cv_prog_SVNVERSION=/bin/false
+# GCC is always complient with IEEE754
+ifeq ($(call qstrip,$(BR2_ENDIAN)),LITTLE)
+PYTHON_CONF_ENV += ac_cv_little_endian_double=yes
+else
+PYTHON_CONF_ENV += ac_cv_big_endian_double=yes
+endif
+
PYTHON_CONF_OPTS += \
--without-cxx-main \
--without-doc-strings \
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* [Buildroot] [PATCH 2/2] python3: fix double format detection
2016-11-09 9:25 [Buildroot] [PATCH 1/2] python: fix double format detection Jérôme Pouiller
@ 2016-11-09 9:25 ` Jérôme Pouiller
2016-11-09 9:33 ` [Buildroot] [PATCH 1/2] python: " Baruch Siach
2016-11-09 21:17 ` Thomas Petazzoni
2 siblings, 0 replies; 4+ messages in thread
From: Jérôme Pouiller @ 2016-11-09 9:25 UTC (permalink / raw)
To: buildroot
Python is not able to detect if compiler double representation is
compliant with IEE754:
checking whether C doubles are little-endian IEEE 754 binary64... no
checking whether C doubles are big-endian IEEE 754 binary64... no
checking whether C doubles are ARM mixed-endian IEEE 754 binary64... no
Accordingly 'legacy' mode isused. It is possible to check this at runtime by
check if 'sys.float_repr_style' contains 'short' or 'legacy'. Calculus
correctness is not garanteed with 'legacy'.
Problem is better described here:
http://stackoverflow.com/questions/29920294/what-causes-pythons-float-repr-style-to-use-legacy
https://bugs.python.org/issue7117
However, all gcc architecture use a representation compliant with IEE754. So,
we can enable it unconditionnaly.
Signed-off-by: J?r?me Pouiller <jezz@sysmic.org>
---
package/python3/python3.mk | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index b3f31c0..cdbe6f0 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -126,6 +126,13 @@ PYTHON3_CONF_ENV += \
ac_cv_working_tzset=yes \
ac_cv_prog_HAS_HG=/bin/false
+# GCC is always compliant with IEEE754
+ifeq ($(call qstrip,$(BR2_ENDIAN)),LITTLE)
+PYTHON3_CONF_ENV += ac_cv_little_endian_double=yes
+else
+PYTHON3_CONF_ENV += ac_cv_big_endian_double=yes
+endif
+
# uClibc is known to have a broken wcsftime() implementation, so tell
# Python 3 to fall back to strftime() instead.
ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 1/2] python: fix double format detection
2016-11-09 9:25 [Buildroot] [PATCH 1/2] python: fix double format detection Jérôme Pouiller
2016-11-09 9:25 ` [Buildroot] [PATCH 2/2] python3: " Jérôme Pouiller
@ 2016-11-09 9:33 ` Baruch Siach
2016-11-09 21:17 ` Thomas Petazzoni
2 siblings, 0 replies; 4+ messages in thread
From: Baruch Siach @ 2016-11-09 9:33 UTC (permalink / raw)
To: buildroot
Hi J?r?me,
On Wed, Nov 09, 2016 at 10:25:07AM +0100, J?r?me Pouiller wrote:
> Python is not able to detect if compiler double representation is
> compliant with IEE754:
>
> checking whether C doubles are little-endian IEEE 754 binary64... no
> checking whether C doubles are big-endian IEEE 754 binary64... no
> checking whether C doubles are ARM mixed-endian IEEE 754 binary64... no
>
> Accordingly 'legacy' mode isused. It is possible to check this at runtime by
> check if 'sys.float_repr_style' contains 'short' or 'legacy'. Calculus
> correctness is not garanteed with 'legacy'.
>
> Problem is better described here:
>
> http://stackoverflow.com/questions/29920294/what-causes-pythons-float-repr-style-to-use-legacy
> https://bugs.python.org/issue7117
>
> However, all gcc architecture use a representation compliant with IEE754. So,
> we can enable it unconditionnaly.
>
> Signed-off-by: J?r?me Pouiller <jezz@sysmic.org>
> ---
> package/python/python.mk | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/package/python/python.mk b/package/python/python.mk
> index cc65376..0191d59 100644
> --- a/package/python/python.mk
> +++ b/package/python/python.mk
> @@ -140,6 +140,13 @@ PYTHON_CONF_ENV += \
> ac_cv_prog_HAS_HG=/bin/false \
> ac_cv_prog_SVNVERSION=/bin/false
>
> +# GCC is always complient with IEEE754
> +ifeq ($(call qstrip,$(BR2_ENDIAN)),LITTLE)
I think that
ifeq ($(BR2_ENDIAN),"LITTLE")
is more readable. That's what most other <pkg>.mk files do.
> +PYTHON_CONF_ENV += ac_cv_little_endian_double=yes
> +else
> +PYTHON_CONF_ENV += ac_cv_big_endian_double=yes
> +endif
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 4+ messages in thread* [Buildroot] [PATCH 1/2] python: fix double format detection
2016-11-09 9:25 [Buildroot] [PATCH 1/2] python: fix double format detection Jérôme Pouiller
2016-11-09 9:25 ` [Buildroot] [PATCH 2/2] python3: " Jérôme Pouiller
2016-11-09 9:33 ` [Buildroot] [PATCH 1/2] python: " Baruch Siach
@ 2016-11-09 21:17 ` Thomas Petazzoni
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2016-11-09 21:17 UTC (permalink / raw)
To: buildroot
Hello,
On Wed, 9 Nov 2016 10:25:07 +0100, J?r?me Pouiller wrote:
> Python is not able to detect if compiler double representation is
> compliant with IEE754:
>
> checking whether C doubles are little-endian IEEE 754 binary64... no
> checking whether C doubles are big-endian IEEE 754 binary64... no
> checking whether C doubles are ARM mixed-endian IEEE 754 binary64... no
>
> Accordingly 'legacy' mode isused. It is possible to check this at runtime by
> check if 'sys.float_repr_style' contains 'short' or 'legacy'. Calculus
> correctness is not garanteed with 'legacy'.
>
> Problem is better described here:
>
> http://stackoverflow.com/questions/29920294/what-causes-pythons-float-repr-style-to-use-legacy
> https://bugs.python.org/issue7117
>
> However, all gcc architecture use a representation compliant with IEE754. So,
> we can enable it unconditionnaly.
>
> Signed-off-by: J?r?me Pouiller <jezz@sysmic.org>
> ---
> package/python/python.mk | 7 +++++++
> 1 file changed, 7 insertions(+)
I've applied both patches, after taking into account the comment from
Baruch. Also, I verified that even ARM is not "mixed endian", by
running the test case under Qemu ARM. It seems like "mixed endian" was
only for the old ARM ABI, which we no longer care about.
Thanks for those patches!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-09 21:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-09 9:25 [Buildroot] [PATCH 1/2] python: fix double format detection Jérôme Pouiller
2016-11-09 9:25 ` [Buildroot] [PATCH 2/2] python3: " Jérôme Pouiller
2016-11-09 9:33 ` [Buildroot] [PATCH 1/2] python: " Baruch Siach
2016-11-09 21:17 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox