* [Buildroot] [PATCH] package/foot: support soft-float architecture
@ 2025-02-04 11:27 Thomas Bonnefille via buildroot
2025-02-04 11:31 ` Thomas Bonnefille via buildroot
2025-02-04 13:08 ` Thomas Petazzoni
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Bonnefille via buildroot @ 2025-02-04 11:27 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Miquèl Raynal, Adam Duskett,
Thomas Bonnefille
Architecture using soft float don't support the math FE_* exceptions.
This commit adds a patch to conditionnally build the FE_* exception
handling.
Fixes:
https://autobuild.buildroot.org/results/88d/88d764dd12bdbdbe633ebc703c461ebe95b75693/
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
...wings-handle-architecture-with-soft-float.patch | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/package/foot/0001-box-drawings-handle-architecture-with-soft-float.patch b/package/foot/0001-box-drawings-handle-architecture-with-soft-float.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6599da1d80a6ed7a3f0f9944bbff82d083177d48
--- /dev/null
+++ b/package/foot/0001-box-drawings-handle-architecture-with-soft-float.patch
@@ -0,0 +1,41 @@
+From 1f66f85c203e48881f8ce5ed7be0316814dfc388 Mon Sep 17 00:00:00 2001
+From: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
+Date: Tue, 4 Feb 2025 09:48:13 +0100
+Subject: [PATCH] box-drawings: handle architecture with soft-float
+
+Currently, architecture using soft-floats doesn't support instructions
+FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW and FE_UNDERFLOW and so building
+on those architectures results with a build error.
+As the sqrt math function should set errno to EDOM if an error occurs,
+fetestexcept shouldn't be mandatory.
+
+This commit makes fetestexcept dependant on if the different
+exceptions exist on the target architecture.
+
+Upstream: https://codeberg.org/dnkl/foot/pulls/1944
+Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
+---
+ box-drawing.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/box-drawing.c b/box-drawing.c
+index 1c613051..e5f67ca7 100644
+--- a/box-drawing.c
++++ b/box-drawing.c
+@@ -1468,8 +1468,11 @@ draw_box_drawings_light_arc(struct buf *buf, char32_t wc)
+ double x = circle_hemisphere * sqrt(c_r2 - (y - c_y) * (y - c_y)) + c_x;
+
+ /* See math_error(7) */
+- if (errno != 0 ||
+- fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW))
++ if (errno != 0
++ #if defined (FE_INVALID) && defined (FE_DIVBYZERO) && defined (FE_OVERFLOW) && defined (FE_UNDERFLOW)
++ || fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
++ #endif
++ )
+ {
+ continue;
+ }
+--
+2.48.1
+
---
base-commit: d5b3795e92727c6565901cddf0c0f17c7854df56
change-id: 20250204-repair_foot-807b55790a7e
Best regards,
--
Thomas Bonnefille <thomas.bonnefille@bootlin.com>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH] package/foot: support soft-float architecture
2025-02-04 11:27 [Buildroot] [PATCH] package/foot: support soft-float architecture Thomas Bonnefille via buildroot
@ 2025-02-04 11:31 ` Thomas Bonnefille via buildroot
2025-02-04 13:08 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bonnefille via buildroot @ 2025-02-04 11:31 UTC (permalink / raw)
To: Thomas Bonnefille, buildroot
Cc: Thomas Petazzoni, Miquèl Raynal, Adam Duskett
Hello,
On Tue Feb 4, 2025 at 12:27 PM CET, Thomas Bonnefille wrote:
> Architecture using soft float don't support the math FE_* exceptions.
> This commit adds a patch to conditionnally build the FE_* exception
> handling.
>
> Fixes:
> https://autobuild.buildroot.org/results/88d/88d764dd12bdbdbe633ebc703c461ebe95b75693/
>
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---
Forgot to say that this issue, also happened on 2024.02 and so, this
patch can be backported to the LTS.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH] package/foot: support soft-float architecture
2025-02-04 11:27 [Buildroot] [PATCH] package/foot: support soft-float architecture Thomas Bonnefille via buildroot
2025-02-04 11:31 ` Thomas Bonnefille via buildroot
@ 2025-02-04 13:08 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2025-02-04 13:08 UTC (permalink / raw)
To: Thomas Bonnefille; +Cc: buildroot, Miquèl Raynal, Adam Duskett
Hello Thomas,
On Tue, 04 Feb 2025 12:27:31 +0100
Thomas Bonnefille <thomas.bonnefille@bootlin.com> wrote:
> Architecture using soft float don't support the math FE_* exceptions.
> This commit adds a patch to conditionnally build the FE_* exception
> handling.
Are you sure it's related to soft-float? For example, ARC has floating
point, but does support some of those FE exceptions.
See for example:
# 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
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
We have this sort of stuff in a few places. Maybe we need to factorize
that?
> +diff --git a/box-drawing.c b/box-drawing.c
> +index 1c613051..e5f67ca7 100644
> +--- a/box-drawing.c
> ++++ b/box-drawing.c
> +@@ -1468,8 +1468,11 @@ draw_box_drawings_light_arc(struct buf *buf, char32_t wc)
> + double x = circle_hemisphere * sqrt(c_r2 - (y - c_y) * (y - c_y)) + c_x;
> +
> + /* See math_error(7) */
> +- if (errno != 0 ||
> +- fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW))
> ++ if (errno != 0
> ++ #if defined (FE_INVALID) && defined (FE_DIVBYZERO) && defined (FE_OVERFLOW) && defined (FE_UNDERFLOW)
> ++ || fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
> ++ #endif
Is it OK to just compile out this code? I mean yes it fixes the build
issues, but is that correct from a runtime perspective?
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-04 13:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04 11:27 [Buildroot] [PATCH] package/foot: support soft-float architecture Thomas Bonnefille via buildroot
2025-02-04 11:31 ` Thomas Bonnefille via buildroot
2025-02-04 13:08 ` Thomas Petazzoni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.