[3/7] libgcc: build the float128 support functions on powerpc*-*-freebsd*

Message ID 20260707144106.10130-4-pkubaj@FreeBSD.org
State New
Headers
Series powerpc64le: support IEEE-128 long double on FreeBSD |

Commit Message

Piotr Kubaj July 7, 2026, 2:40 p.m. UTC
  The IEEE-128 (__float128 / KFmode) soft-float support functions in
libgcc are only built when libgcc_cv_powerpc_float128 is set, and the
ISA-2.06 configure check that sets it only runs for powerpc*-*-linux*.
On powerpc64le-*-freebsd*, where long double is IEEE binary128, they are
needed just as much (libgfortran and any long-double code references
e.g. __addkf3, __eqkf2), so run the check there too.

Also require __ibm128 in the test, not just VSX: the t-float128 sources
the check enables include quad-float128.h, which uses __ibm128.  That
type is only available when the target has 128-bit long double, so on a
target/multilib where long double is 64-bit (e.g. a pre-IEEE FreeBSD
release) the VSX-only test would pass but the build would then fail with
"unknown type name '__ibm128'".  Requiring __ibm128 makes the check
reflect what the sources need; it is a no-op on glibc, which always has
128-bit long double on these configurations.

libgcc/ChangeLog:

	* configure.ac (powerpc*-*-freebsd*): Run the PowerPC ISA 2.06
	__float128 check.  Require __ibm128 in the test.
	* configure: Regenerate.

Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
---
 libgcc/configure.ac | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Patch

diff --git a/libgcc/configure.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -432,13 +432,14 @@ 
 # check if we have VSX (ISA 2.06) support to build the software libraries, and
 # whether the assembler can handle xsaddqp for hardware support.  Also check if
 # a new glibc is being used so that __builtin_cpu_supports can be used.
-powerpc*-*-linux*)
+powerpc*-*-linux* | powerpc*-*-freebsd*)
   saved_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
   AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries],
 		 [libgcc_cv_powerpc_float128],
 		 [AC_COMPILE_IFELSE(
-    [AC_LANG_SOURCE([vector double dadd (vector double a, vector double b) { return a + b; }])],
+    [AC_LANG_SOURCE([vector double dadd (vector double a, vector double b) { return a + b; }
+__ibm128 conftest_ibm128;])],
     [libgcc_cv_powerpc_float128=yes],
     [libgcc_cv_powerpc_float128=no])])