Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] arch: move global and rename variable BR2_PACKAGE_Z3_ARCH_SUPPORTS
@ 2023-02-09  0:48 Giulio Benetti
  2023-02-09  0:56 ` Giulio Benetti
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Giulio Benetti @ 2023-02-09  0:48 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain, Giulio Benetti

Package quickjs fails to build on architectures that don't support full
float rounding. To support all kind of float rounding FE_DOWNWARD,
FE_TONEAREST, FE_TOWARDZERO, FE_UPWARD must be defined in fenv.h.
Since package z3 locally implements this check let's make it global,
rename it to be generic and use it for both package quickjs and z3.

Fixes:
http://autobuild.buildroot.net/results/0b6/0b67381e3643c134c92cbcd1c5dc258fd760cd7e/
http://autobuild.buildroot.net/results/cf2/cf249a82c83d3c8503205f4c3c5859dd9d52afdf/
http://autobuild.buildroot.net/results/9b3/9b37c6c55a5b468657af26ef9b57d4fe24d8fde2/
http://autobuild.buildroot.net/results/4f1/4f13cf7d353260c6b8934dbdcf267bea884b356b/

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 arch/Config.in            | 24 ++++++++++++++++++++++++
 package/quickjs/Config.in |  4 ++--
 package/z3/Config.in      | 25 +------------------------
 3 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/arch/Config.in b/arch/Config.in
index 1c0c400a98..90846861ca 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -253,6 +253,30 @@ config BR2_xtensa
 
 endchoice
 
+# Not all architectures support float rounding. This can be found while
+# checking if fenv.h provides all four macros:
+# FE_DOWNWARD, FE_TONEAREST, FE_TOWARDZERO, FE_UPWARD
+# See for example in glibc https://sourceware.org/git/glibc.git
+# git grep -E '^[[:space:]]*#[[:space:]]*define[[:space:]]+FE_(TONEAREST|UPWARD|DOWNWARD|TOWARDZERO)' sysdeps/
+config BR2_PACKAGE_ARCH_HAS_ALL_FLOAT_ROUNDING
+	bool
+	default y if BR2_aarch64 || BR2_aarch64_be
+	default y if BR2_arceb || BR2_arcle
+	default y if BR2_arm || BR2_armeb
+	default y if BR2_i386
+	default y if BR2_m68k
+	# BR2_microblaze has only FE_TONEAREST
+	default y if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
+	# BR2_nios2 has only FE_TONEAREST
+	default y if BR2_or1k
+	default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
+	default y if BR2_riscv
+	default y if BR2_s390x
+	# BR2_sh has only FE_{TONEAREST,TOWARDZERO}
+	default y if BR2_sparc || BR2_sparc64
+	default y if BR2_x86_64
+	# BR2_xtensa supports only uclibc which does not have fenv.h
+
 # For some architectures or specific cores, our internal toolchain
 # backend is not suitable (like, missing support in upstream gcc, or
 # no ChipCo fork exists...)
diff --git a/package/quickjs/Config.in b/package/quickjs/Config.in
index dc466241ba..6f24787333 100644
--- a/package/quickjs/Config.in
+++ b/package/quickjs/Config.in
@@ -1,6 +1,6 @@
 config BR2_PACKAGE_QUICKJS
 	bool "quickjs"
-	depends on !BR2_nios2 # fenv.h lacks FE_{DOWN,UP}WARD on nios2
+	depends on BR2_PACKAGE_ARCH_HAS_ALL_FLOAT_ROUNDING # fenv.h lacks FE_{DOWN,UP}WARD
 	depends on !BR2_STATIC_LIBS
 	# No way to check for fenv support.
 	depends on !BR2_TOOLCHAIN_USES_UCLIBC
@@ -15,7 +15,7 @@ config BR2_PACKAGE_QUICKJS
 	  https://bellard.org/quickjs/
 
 comment "quickjs needs a glibc or musl toolchain w/ gcc >= 4.9, host gcc >= 4.9, dynamic library"
-	depends on !BR2_nios2
+	depends on BR2_PACKAGE_ARCH_HAS_ALL_FLOAT_ROUNDING
 	depends on BR2_USE_MMU
 	depends on BR2_STATIC_LIBS || BR2_TOOLCHAIN_USES_UCLIBC || \
 		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_HOST_GCC_AT_LEAST_4_9
diff --git a/package/z3/Config.in b/package/z3/Config.in
index 8cd3128687..5ceca5dbe2 100644
--- a/package/z3/Config.in
+++ b/package/z3/Config.in
@@ -1,33 +1,10 @@
-# z3 supports arch for which libc fenv.h provides all four macros:
-# FE_DOWNWARD, FE_TONEAREST, FE_TOWARDZERO, FE_UPWARD
-# See for example in glibc https://sourceware.org/git/glibc.git
-# git grep -E '^[[:space:]]*#[[:space:]]*define[[:space:]]+FE_(TONEAREST|UPWARD|DOWNWARD|TOWARDZERO)' sysdeps/
-config BR2_PACKAGE_Z3_ARCH_SUPPORTS
-	bool
-	default y if BR2_aarch64 || BR2_aarch64_be
-	default y if BR2_arceb || BR2_arcle
-	default y if BR2_arm || BR2_armeb
-	default y if BR2_i386
-	default y if BR2_m68k
-	# BR2_microblaze has only FE_TONEAREST
-	default y if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
-	# BR2_nios2 has only FE_TONEAREST
-	default y if BR2_or1k
-	default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
-	default y if BR2_riscv
-	default y if BR2_s390x
-	# BR2_sh has only FE_{TONEAREST,TOWARDZERO}
-	default y if BR2_sparc || BR2_sparc64
-	default y if BR2_x86_64
-	# BR2_xtensa supports only uclibc which does not have fenv.h
-
 config BR2_PACKAGE_Z3
 	bool "z3"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # c++17
 	# z3 needs fenv.h which is not provided by uclibc
 	depends on !BR2_TOOLCHAIN_USES_UCLIBC
-	depends on BR2_PACKAGE_Z3_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_ARCH_HAS_ALL_FLOAT_ROUNDING
 	help
 	  Z3, also known as the Z3 Theorem Prover, is a cross-platform
 	  satisfiability modulo theories (SMT) solver.
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-30 21:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-09  0:48 [Buildroot] [PATCH] arch: move global and rename variable BR2_PACKAGE_Z3_ARCH_SUPPORTS Giulio Benetti
2023-02-09  0:56 ` Giulio Benetti
2023-02-09  7:54 ` Thomas Petazzoni via buildroot
2023-02-09 14:45   ` Giulio Benetti
2023-02-09 19:36 ` Julien Olivain
2023-02-09 20:54   ` Giulio Benetti
2023-09-30 21:10     ` Romain Naour
2023-09-30 20:47 ` Romain Naour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox