Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] arch/or1k: fix uClibc issues with fenv enabled
@ 2026-08-19 22:15 Waldemar Brodkorb
  0 siblings, 0 replies; only message in thread
From: Waldemar Brodkorb @ 2026-08-19 22:15 UTC (permalink / raw)
  To: buildroot

OpenRISC architecture can be either soft-float or hard-float, so add the
ability to the user to configure it.

GNU libc has hard-float support since 03 May 2024, see here:
https://sourceware.org/pipermail/glibc-cvs/2024q2/085211.html
There fenv functions f.e. were added to glibc.

uClibc-ng has added fenv functions in commit 8a77b4785acd143d76ccc08142abb39c0100de3d
on 27 April 2025.

musl does not have any or1k architecture specific fenv support.

Tested with all 6 combinations of C libraries and float configurations.

For uClibc-ng fenv support was enabled by commit 4c5039b80ebbe42db35af189afcff7fb7d5cace6
in Buildroot for any hard-float toolchain, so we now need to pass
-mhard-float to gcc compiler to get the predefined preprocessor macro __or1k_hard_float__,
which exposes _FPU_FPCSR_RM_MASK.

Fixes:
 - https://autobuild.buildroot.org/results/a60737adf3fdd26e8d0ae3310bef5c48716889dc

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 arch/Config.in.or1k | 9 +++++++++
 package/Makefile.in | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/arch/Config.in.or1k b/arch/Config.in.or1k
index f42aef9eef..e626907496 100644
--- a/arch/Config.in.or1k
+++ b/arch/Config.in.or1k
@@ -1,3 +1,12 @@
+config BR2_OR1K_SOFT_FLOAT
+	bool "Use soft-float"
+	select BR2_SOFT_FLOAT
+	help
+	  If your target CPU does not have a Floating Point Unit (FPU)
+	  or a kernel FPU emulator, but you still wish to support
+	  floating point functions, then everything will need to be
+	  compiled with soft floating point support (-msoft-float).
+
 config BR2_ARCH
 	default "or1k"
 
diff --git a/package/Makefile.in b/package/Makefile.in
index eac28b3a96..69859e8ce4 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -106,6 +106,14 @@ TARGET_ABI += -mabi=spe -mfloat-gprs=double -Wa,-me500mc
 endif
 endif
 
+# use hard-float option globally for OpenRISC, when not
+# soft-float choosen by the user.
+ifeq ($(BR2_or1k),y)
+ifneq ($(BR2_OR1K_SOFT_FLOAT),y)
+TARGET_ABI += -mhard-float
+endif
+endif
+
 # Use longcalls option for Xtensa globally.
 # The 'longcalls' option allows calls across a greater range of addresses,
 # and is required for some packages. While this option can degrade both
-- 
2.47.3

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-19 22:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 22:15 [Buildroot] [PATCH] arch/or1k: fix uClibc issues with fenv enabled Waldemar Brodkorb

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