Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Cc: buildroot@buildroot.org,
	"Miquèl Raynal" <miquel.raynal@bootlin.com>,
	"Adam Duskett" <adam.duskett@amarulasolutions.com>
Subject: Re: [Buildroot] [PATCH] package/foot: support soft-float architecture
Date: Tue, 4 Feb 2025 14:08:08 +0100	[thread overview]
Message-ID: <20250204140808.5c6fe0fa@windsurf> (raw)
In-Reply-To: <20250204-repair_foot-v1-1-498406d0a384@bootlin.com>

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

      parent reply	other threads:[~2025-02-04 13:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250204140808.5c6fe0fa@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=adam.duskett@amarulasolutions.com \
    --cc=buildroot@buildroot.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=thomas.bonnefille@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox