From patchwork Tue Jul 7 14:40:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Kubaj X-Patchwork-Id: 138660 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D5F94BA23D8 for ; Tue, 7 Jul 2026 14:42:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D5F94BA23D8 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.anongoth.pl (mail.anongoth.pl [IPv6:2001:470:71:6b::3]) by sourceware.org (Postfix) with ESMTPS id B49B74BA2E31; Tue, 7 Jul 2026 14:41:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B49B74BA2E31 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anongoth.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B49B74BA2E31 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:470:71:6b::3 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435288; cv=none; b=B5aLPT8fNltLwzk6dbgaTXjgOAboddnjXv/deulBBupRE6zcfkXOU5eBLZ6hVHuMqNJ6/IFkjFZlmkYNZxkm86IYQdQ4fCNIKElIe5TSsLWG5iLjlwjTc/WuI9u2OsIBX57wY9rZhcN75mkUbet6WrdtKz4hA3FqhO2s5STuH3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435288; c=relaxed/simple; bh=S7IqX5ZZhnyMyoGXaQkbFZixDELoB8awLWwF1Lb6J7I=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=dD3l3maWSIWAHplhLg579LNsZ7+nNMzk7FDl826fiEmm644QVqUwruXeKtZZpPgLJhn5zT2M5/41Ztv53+G/diCHqThhTS3qyNxuCi5hGbwaUBwQ3E3auKxhFfG3pSI39fJwZlQ1j4p5RIugczUk9bkKES1+AaWKKV2imq7Lc1c= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B49B74BA2E31 Received: by mail.anongoth.pl (Postfix) id 4948A182EA; Tue, 07 Jul 2026 16:41:27 +0200 (CEST) Authentication-Results: mail.anongoth.pl; dmarc=fail (p=none dis=none) header.from=FreeBSD.org From: Piotr Kubaj To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Segher Boessenkool , "Kewen . Lin" , Peter Bergner , Piotr Kubaj Subject: [PATCH 1/7] rs6000: default long double to IEEE 128-bit on powerpc*le Date: Tue, 7 Jul 2026 16:40:03 +0200 Message-ID: <20260707144106.10130-2-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260707144106.10130-1-pkubaj@FreeBSD.org> References: <20260707144106.10130-1-pkubaj@FreeBSD.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org When GCC is configured with --with-long-double-format=ieee, set the IEEE-quad target defines for powerpc*le so that long double defaults to IEEE binary128. This is required for powerpc64le-*-freebsd*: FreeBSD 16 uses IEEE-128 long double in its base ABI. gcc/ChangeLog: * config.gcc (powerpc*le-*-*): Set RS6000_DEFAULT_LONG_DOUBLE_SIZE, TARGET_IEEEQUAD_DEFAULT and TARGET_FLOAT128_ENABLE_TYPE when --with-long-double-format=ieee. Signed-off-by: Piotr Kubaj --- gcc/config.gcc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/config.gcc b/gcc/config.gcc --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -3071,7 +3071,10 @@ tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" case ${target} in powerpc*le-*-*) - tm_file="${tm_file} rs6000/sysv4le.h" ;; + tm_file="${tm_file} rs6000/sysv4le.h" + if test x$with_long_double_format = xieee; then + tm_defines="${tm_defines} RS6000_DEFAULT_LONG_DOUBLE_SIZE=128 TARGET_IEEEQUAD_DEFAULT=1 TARGET_FLOAT128_ENABLE_TYPE=1" + fi ;; esac case ${target} in powerpc64*) From patchwork Tue Jul 7 14:40:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Kubaj X-Patchwork-Id: 138658 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2EDC74BA7994 for ; Tue, 7 Jul 2026 14:42:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EDC74BA7994 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.anongoth.pl (mail.anongoth.pl [IPv6:2001:470:71:6b::3]) by sourceware.org (Postfix) with ESMTPS id 3878C4BA23C3; Tue, 7 Jul 2026 14:41:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3878C4BA23C3 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anongoth.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3878C4BA23C3 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:470:71:6b::3 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435291; cv=none; b=LSrlCeLk8dj2EuVslNnOIQro1pYs5axRGyDdEXaV3DCJQ4Kw4lkQdC1Ewcq5Iqiid5y9CHDpnqXwyZ0bmKx+Y7B7P6/StNP5Y5arTMcf64QJzXKCT67hOuERoJUwBlKtWpwFu2rzrICtQJX8L4T9hvy1WFSZM6ZrNNAmSh0Ny84= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435291; c=relaxed/simple; bh=unR/o4YQehjNBmivQnOD3Io5V41Wuqy96BOPIC/vXW8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=iOMPzHR8WDW+uLjb45Kw6vLsE5NIeU1S4+L34nGFcoqbyuSaitM3u63dToiO15F76jjpLgDFYARVOBV48ymnt3tfRMQo2Amk1hNZv/8cmLyr7UYX8/z1AjvVIO2EymCweiadulvQQR0Pr7JRjDfBy3KOwVc9TD3O5bXovurgJPY= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3878C4BA23C3 Received: by mail.anongoth.pl (Postfix) id D9D6F18AF0; Tue, 07 Jul 2026 16:41:29 +0200 (CEST) Authentication-Results: mail.anongoth.pl; dmarc=fail (p=none dis=none) header.from=FreeBSD.org From: Piotr Kubaj To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Segher Boessenkool , "Kewen . Lin" , Peter Bergner , Piotr Kubaj Subject: [PATCH 2/7] configure: accept --with-long-double-format on powerpc64le-*-freebsd* Date: Tue, 7 Jul 2026 16:40:04 +0200 Message-ID: <20260707144106.10130-3-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260707144106.10130-1-pkubaj@FreeBSD.org> References: <20260707144106.10130-1-pkubaj@FreeBSD.org> MIME-Version: 1.0 X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org configure rejects --with-long-double-format for target:format combinations that are not whitelisted. Add the powerpc64le FreeBSD entries next to the existing powerpc64le-linux ones. gcc/ChangeLog: * configure.ac (--with-long-double-format): Accept powerpc64le-*-freebsd*. * configure: Regenerate. Signed-off-by: Piotr Kubaj --- gcc/configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/configure.ac b/gcc/configure.ac --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -7007,7 +7007,8 @@ [AS_HELP_STRING([--with-long-double-format={ieee,ibm}] [Specify whether PowerPC long double uses IEEE or IBM format])],[ case "$target:$with_long_double_format" in - powerpc64le-*-linux*:ieee | powerpc64le-*-linux*:ibm) + powerpc64le-*-linux*:ieee | powerpc64le-*-linux*:ibm | \ + powerpc64le-*-freebsd*:ieee | powerpc64le-*-freebsd*:ibm) : ;; powerpc64-*-linux*:ieee | powerpc64-*-linux*:ibm) From patchwork Tue Jul 7 14:40:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Kubaj X-Patchwork-Id: 138659 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D6D24BA7984 for ; Tue, 7 Jul 2026 14:42:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D6D24BA7984 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.anongoth.pl (mail.anongoth.pl [IPv6:2001:470:71:6b::3]) by sourceware.org (Postfix) with ESMTPS id 8333F4BA23C4; Tue, 7 Jul 2026 14:41:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8333F4BA23C4 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anongoth.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8333F4BA23C4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:470:71:6b::3 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435293; cv=none; b=foTOcG9EAsfKq617+pMnapPPpslGZvoEXkl86/5lgYbca3XAcTPGCLQKxKNgkDhvlzp0OHvtmHzuxbw+yU+DTlAB2ILTRTA2/rcoJIg6ktZpGVWOG3bGemuOpMnTGFTPY3ZhmuU23lTlOWjKutwdgVI8rNLCvCbbnOJpQ/9ZXoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435293; c=relaxed/simple; bh=o3tlSqj0DjlA/mx+s/RRbYG6xTmU9U33VJetRkTDVWM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=jC1H88F3eNLNC/K6iQsi46Dn1U2nLXc6ufSkltjHwSau5CSSHLTAmxjDFnHpB44geVr+VxVMXBV5IT8KFmOa2DDQAtf9O5nDrcg7SkLNpBcrlJMET038ZA9qtuHviTklZlcUv+OQJcw0BHcnw/SWTU0PTMfY0qcDSK55m/ofNBI= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8333F4BA23C4 Received: by mail.anongoth.pl (Postfix) id 36D1918B16; Tue, 07 Jul 2026 16:41:32 +0200 (CEST) Authentication-Results: mail.anongoth.pl; dmarc=fail (p=none dis=none) header.from=FreeBSD.org From: Piotr Kubaj To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Segher Boessenkool , "Kewen . Lin" , Peter Bergner , Piotr Kubaj Subject: [PATCH 3/7] libgcc: build the float128 support functions on powerpc*-*-freebsd* Date: Tue, 7 Jul 2026 16:40:05 +0200 Message-ID: <20260707144106.10130-4-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260707144106.10130-1-pkubaj@FreeBSD.org> References: <20260707144106.10130-1-pkubaj@FreeBSD.org> MIME-Version: 1.0 X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org 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 --- libgcc/configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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])]) From patchwork Tue Jul 7 14:40:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Kubaj X-Patchwork-Id: 138662 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B764F4BA23D3 for ; Tue, 7 Jul 2026 14:43:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B764F4BA23D3 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61]) by sourceware.org (Postfix) with ESMTPS id 648484BA23F4; Tue, 7 Jul 2026 14:41:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 648484BA23F4 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anongoth.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 648484BA23F4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=46.248.190.61 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435296; cv=none; b=D8UKbjTlpQBl6aocEgDrB3L5tgczV3jEtQARwLKXW2JS0KvWy7g0ZPr5twYaoaeYcgsglhKsLfDjEW7xmt740bNKy1zGzCV+86MKlYZOqoqQa57J7GDAswC3n04bS1z9G2TDlEpMK7vyhjsEOgTh59BU4ucbolJowW4ByTysdYc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435296; c=relaxed/simple; bh=octhG86aRZTLCN3/qyvUsS/rj4aU44z1396veJOOmCY=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=kWvS8oubuIMNtwRfgnTdb6ff86uOfEV67ORbhmZ4h75PKUSpwuFq+fN838+C296G2u+V5fRKAFOgYTIqWMdXLitS3fycaDFk5UUSGapIpJH46JjcoCBcJC8FoCowJ78kWSCKltMUQn5Ve0LwHQyj412epOa9Q1yj7hq6C9ScCPE= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 648484BA23F4 Received: by mail.anongoth.pl (Postfix) id CB5A018E08; Tue, 07 Jul 2026 16:41:34 +0200 (CEST) Authentication-Results: mail.anongoth.pl; dmarc=fail (p=none dis=none) header.from=FreeBSD.org From: Piotr Kubaj To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Segher Boessenkool , "Kewen . Lin" , Peter Bergner , Piotr Kubaj Subject: [PATCH 4/7] libgcc: build and export the float128 helpers for powerpc64*-*-freebsd* Date: Tue, 7 Jul 2026 16:40:06 +0200 Message-ID: <20260707144106.10130-5-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260707144106.10130-1-pkubaj@FreeBSD.org> References: <20260707144106.10130-1-pkubaj@FreeBSD.org> MIME-Version: 1.0 X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Wire the t-float128 fragment into the FreeBSD powerpc64 configuration so the KFmode soft-float functions are built. On glibc the plain __*kf* entry points are exported from libgcc_s.so by the float128 IFUNC in t-float128-hw. That fragment is unusable on FreeBSD (its runtime dispatch needs the Linux AT_PLATFORM auxv entry), so t-float128 alone puts the software functions only into the static libgcc.a via LIB2ADD_ST, and hidden. A gcc-built shared object such as libstdc++.so then references e.g. __eqkf2 (for IEEE-128 long double) with no shared provider, and linking an executable against it fails with "hidden symbol `__eqkf2' ... is referenced by DSO". Add a FreeBSD-only t-float128-freebsd fragment that routes the software functions into libgcc_s.so (LIB2ADD) and a version script that exports them under GCC_7.0.0. __mulkc3/__divkc3 are excluded from the shared addition: under -mabi=ieeelongdouble libgcc2.c's __multc3/__divtc3 are already mangled to those names, so the version script just exports the libgcc2.c copies. libgcc/ChangeLog: * config.host (powerpc64*-*-freebsd*): Add rs6000/t-float128 and rs6000/t-float128-freebsd to tmake_file when float128 is supported, and rs6000/t-float128-hw when hardware float128 is supported. * config/rs6000/t-float128-freebsd: New file. * config/rs6000/libgcc-freebsd-float128.ver: New file. Signed-off-by: Piotr Kubaj --- libgcc/config.host | 6 ++++++ libgcc/config/rs6000/t-float128-freebsd | 15 +++++++++++++++ libgcc/config/rs6000/libgcc-freebsd-float128.ver | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/libgcc/config.host b/libgcc/config.host --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1230,6 +1230,12 @@ powerpc64*) tmake_file="${tmake_file} rs6000/t-freebsd64" md_unwind_header=rs6000/freebsd-unwind.h + if test $libgcc_cv_powerpc_float128 = yes; then + tmake_file="${tmake_file} rs6000/t-float128 rs6000/t-float128-freebsd" + fi + if test $libgcc_cv_powerpc_float128_hw = yes; then + tmake_file="${tmake_file} rs6000/t-float128-hw" + fi ;; esac ;; diff --git a/libgcc/config/rs6000/t-float128-freebsd b/libgcc/config/rs6000/t-float128-freebsd new file mode 100644 --- /dev/null +++ b/libgcc/config/rs6000/t-float128-freebsd @@ -0,0 +1,15 @@ +# On FreeBSD there is no float128 IFUNC (rs6000/t-float128-hw needs the Linux +# AT_PLATFORM auxv entry, absent on FreeBSD), so the software __float128/KFmode +# helpers built by rs6000/t-float128 would only land in the static libgcc.a +# (hidden) via LIB2ADD_ST. Put them in the shared libgcc_s.so and export them +# (see libgcc-freebsd-float128.ver) so gcc-built DSOs -- notably libstdc++.so, +# which references e.g. __eqkf2 for IEEE-128 long double -- resolve them. +# +# Exclude __mulkc3/__divkc3: under -mabi=ieeelongdouble libgcc2.c's __multc3/ +# __divtc3 are already mangled to those names in libgcc_s.so, so adding rs6000's +# own copies to the shared library would multiply-define them. They stay +# static-only; the .ver exports the libgcc2.c-provided ones. +fp128_shared_src := $(filter-out %/_mulkc3.c %/_divkc3.c,$(fp128_src)) +LIB2ADD_ST := $(filter-out $(fp128_shared_src),$(LIB2ADD_ST)) +LIB2ADD += $(fp128_shared_src) +SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-freebsd-float128.ver diff --git a/libgcc/config/rs6000/libgcc-freebsd-float128.ver b/libgcc/config/rs6000/libgcc-freebsd-float128.ver new file mode 100644 --- /dev/null +++ b/libgcc/config/rs6000/libgcc-freebsd-float128.ver @@ -0,0 +1,35 @@ +# IEEE-128 (__float128 / KFmode) software helpers exported from libgcc_s.so on +# FreeBSD, where there is no float128 IFUNC. Attached to GCC_7.0.0, the version +# where PowerPC __float128 support was introduced. +GCC_7.0.0 { + __addkf3 + __subkf3 + __mulkf3 + __divkf3 + __negkf2 + __unordkf2 + __eqkf2 + __gekf2 + __lekf2 + __extendsfkf2 + __extenddfkf2 + __trunckfsf2 + __trunckfdf2 + __fixkfsi + __fixkfdi + __fixunskfsi + __fixunskfdi + __floatsikf + __floatdikf + __floatunsikf + __floatundikf + __floattikf + __floatuntikf + __fixkfti + __fixunskfti + __extendkftf2 + __trunctfkf2 + __mulkc3 + __divkc3 + __powikf2 +} From patchwork Tue Jul 7 14:40:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Kubaj X-Patchwork-Id: 138663 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 48E134BA23CB for ; Tue, 7 Jul 2026 14:44:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48E134BA23CB X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61]) by sourceware.org (Postfix) with ESMTPS id 7E6DA4BA23EF; Tue, 7 Jul 2026 14:41:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E6DA4BA23EF Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anongoth.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7E6DA4BA23EF Authentication-Results: sourceware.org; arc=none smtp.remote-ip=46.248.190.61 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435299; cv=none; b=YyxWnkw2n3DJFrDxRJMMTZ0V/s5k1QeJpRm5j+FrvwGp91GN+gBs4J1r3+P40IiKaqs7Mo/AB2Tu3G1y1YQqQ9wydoagGMCC/+jM4lYcUNWRlOt3f4E025z1HXsEUY+PFXzM1q+Pr7k6lcbxj+GD/3e97OYxfa6ELytVthUPFsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435299; c=relaxed/simple; bh=PbA1Ojy+pWGnhnRK3WDkKcwOia47eGNYgj19xD3t/8o=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=J/gA3ZUOeqHy1DpVoKM5e4qEwYntcu7i08x/DEbohFU8RrbFZlzmm9Wd7N+hghsxyACvAJwdAsOAoD4w3pW7uDn7RsSmBmJjs89ccgtLy1mee9gWJHNUjx6EEqjZEL0K3A9ymtHl1rrituITnH4Q8SFe6fLEClO06L38l3RIGU0= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E6DA4BA23EF Received: by mail.anongoth.pl (Postfix) id 36BF218B17; Tue, 07 Jul 2026 16:41:38 +0200 (CEST) Authentication-Results: mail.anongoth.pl; dmarc=fail (p=none dis=none) header.from=FreeBSD.org From: Piotr Kubaj To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Segher Boessenkool , "Kewen . Lin" , Peter Bergner , Piotr Kubaj Subject: [PATCH 5/7] rs6000: only remap long double built-ins to __*ieee128 with glibc Date: Tue, 7 Jul 2026 16:40:07 +0200 Message-ID: <20260707144106.10130-6-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260707144106.10130-1-pkubaj@FreeBSD.org> References: <20260707144106.10130-1-pkubaj@FreeBSD.org> MIME-Version: 1.0 X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org rs6000_mangle_decl_assembler_name rewrites the long double math built-ins (sqrtl -> __sqrtieee128, and the fused sincos) to the names glibc exports for IEEE-128 long double, gated only on TARGET_IEEEQUAD. On a non-glibc target such as FreeBSD those __*ieee128 names do not exist, so code using long double math (e.g. libgfortran's cargl calling atan2l) ends up with unsatisfiable references. Gate the remapping on glibc_supports_ieee_128bit (), which exists for exactly this purpose: only rewrite to glibc's names when glibc provides them. Non-glibc targets keep the plain *l names, which their libm provides as IEEE-128. The complex multiply/divide remapping above is unchanged (those map to libgcc's __mulkc3/__divkc3, present everywhere). gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_mangle_decl_assembler_name): Only remap long double built-ins to __*ieee128 when glibc_supports_ieee_128bit (). Signed-off-by: Piotr Kubaj --- gcc/config/rs6000/rs6000.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -28563,6 +28563,7 @@ /* Map long double built-in functions if long double is IEEE 128-bit. */ if (TARGET_FLOAT128_TYPE && TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128 + && glibc_supports_ieee_128bit () && TREE_CODE (decl) == FUNCTION_DECL && DECL_IS_UNDECLARED_BUILTIN (decl) && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL) From patchwork Tue Jul 7 14:40:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Kubaj X-Patchwork-Id: 138664 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A29084BA23D9 for ; Tue, 7 Jul 2026 14:44:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A29084BA23D9 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61]) by sourceware.org (Postfix) with ESMTPS id E3FD74BA23F4; Tue, 7 Jul 2026 14:41:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3FD74BA23F4 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anongoth.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E3FD74BA23F4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=46.248.190.61 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435302; cv=none; b=kW2VayT0KeGXeggU4xVw2evOvGWKRcXel+CpM9CNrQdKTR3cmaeilFjv3whFS1e9J8Lien9OI7kr4AjIYCtEtoRH3oSgnwtaTWoxgnKVzr/k2BxIFbr6wTxI1IQKyfzkXg7Vj/PwfQm/L4pcwWUobhBp6DaXxnKbGLfZgUY3Tc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435302; c=relaxed/simple; bh=uTk1S67fCFQuO8QEdlxjQPHSJDVXWSazLY9OLH7dreU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=DN7qahfFvQFzDgtiNFFkkb8qrEvvO+/IZEE6JDkQpM3peZEl7PujBxhxq/BqVBBa30u4sI/HWqnZIev8p6VEgkZCxm/JE43L5TOqBTgqa54RxR89HUZFvSxYdAZOfssPIu8AkiI0wqkFk/8HmPb7dq11yv4yGwv45GhmOsOEdeQ= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3FD74BA23F4 Received: by mail.anongoth.pl (Postfix) id 8FD3D18E83; Tue, 07 Jul 2026 16:41:40 +0200 (CEST) Authentication-Results: mail.anongoth.pl; dmarc=fail (p=none dis=none) header.from=FreeBSD.org From: Piotr Kubaj To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Segher Boessenkool , "Kewen . Lin" , Peter Bergner , Piotr Kubaj Subject: [PATCH 6/7] fortran: only apply the IEEE-128 long double kind remap with glibc Date: Tue, 7 Jul 2026 16:40:08 +0200 Message-ID: <20260707144106.10130-7-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260707144106.10130-1-pkubaj@FreeBSD.org> References: <20260707144106.10130-1-pkubaj@FreeBSD.org> MIME-Version: 1.0 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org gfc_init_kinds detects the powerpc64le -mabi=ieeelongdouble case and, for libgfortran, gives REAL(KIND=16) the ABI of KIND=17 and routes its runtime math through the glibc *ieee128 / libquadmath entry points. That machinery is glibc-specific (it is keyed on TARGET_GLIBC_MAJOR/MINOR); on a non-glibc target such as FreeBSD it makes libgfortran reference names that do not exist (__*ieee128, and libquadmath *q such as iroundq). Restrict the block to glibc (TARGET_GLIBC_MAJOR >= 2). On FreeBSD long double is native IEEE-128, so REAL(KIND=16) keeps its natural kind-16 ABI and its math resolves to the plain *l libm entry points. gcc/fortran/ChangeLog: * trans-types.cc (gfc_init_kinds): Only apply the -mabi=ieeelongdouble kind remapping on glibc. Signed-off-by: Piotr Kubaj --- gcc/fortran/trans-types.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc --- a/gcc/fortran/trans-types.cc +++ b/gcc/fortran/trans-types.cc @@ -513,7 +513,8 @@ precision. For libgfortran calls pretend the IEEE 754 quad TFmode has kind 17 rather than 16 and use kind 16 for the IBM extended format TFmode. */ - if (composite_mode != QImode && saw_r16 && !MODE_COMPOSITE_P (r16_mode)) + if (composite_mode != QImode && saw_r16 && !MODE_COMPOSITE_P (r16_mode) + && TARGET_GLIBC_MAJOR >= 2) { for (int i = 0; i < r_index; ++i) if (gfc_real_kinds[i].kind == 16) From patchwork Tue Jul 7 14:40:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Kubaj X-Patchwork-Id: 138661 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 953D74BA23DB for ; Tue, 7 Jul 2026 14:42:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 953D74BA23DB X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.anongoth.pl (mail.anongoth.pl [IPv6:2001:470:71:6b::3]) by sourceware.org (Postfix) with ESMTPS id 58B854BA23FD; Tue, 7 Jul 2026 14:41:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58B854BA23FD Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anongoth.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 58B854BA23FD Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:470:71:6b::3 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435304; cv=none; b=gbbJ5ULLCDFX84t/SxmmV7mCDV+UhdEIMht/2bQRHAvC/h9RE//J3FFLEz+/0yScir/c1p5H+2apjHEjo7iCN3Vp9/f3OPSl36BoAf7idi8vUG9QmZCH6tGK6bleXsqodsWjNcs5U1Ex8q4uyQSkuBRp9pGiVJdQkarCb8V5454= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435304; c=relaxed/simple; bh=68BhgmuArQsGPU1UW+xF6u6M2Gigbjdb93Kn1mgUdbM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=xWvNf8f0oZR54foUodTRtueXQnTDKHdTxR/yU1tfI1wEuaav2jiB64M/DmpJzKA25of4OVanxyruAOh7n2Ptaljn4ur4wwaUHeklhuzP92UPs4HZcZtOXhLzmHFGeDEGswqdUB24hY7uXGIV/Kgqu9Jrzx8t9GjL28QyuXreKVo= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58B854BA23FD Received: by mail.anongoth.pl (Postfix) id 0AD8318E09; Tue, 07 Jul 2026 16:41:42 +0200 (CEST) Authentication-Results: mail.anongoth.pl; dmarc=fail (p=none dis=none) header.from=FreeBSD.org From: Piotr Kubaj To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Segher Boessenkool , "Kewen . Lin" , Peter Bergner , Piotr Kubaj Subject: [PATCH 7/7] libgfortran: don't add REAL(KIND=17) when long double is IEEE 128-bit Date: Tue, 7 Jul 2026 16:40:09 +0200 Message-ID: <20260707144106.10130-8-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260707144106.10130-1-pkubaj@FreeBSD.org> References: <20260707144106.10130-1-pkubaj@FreeBSD.org> MIME-Version: 1.0 X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org On powerpc64le, kinds-override.h unconditionally defines a second 128-bit real kind (REAL(KIND=17), _Float128) whenever long double is 16 bytes, assuming long double is IBM double-double so a distinct IEEE-128 kind is needed. When long double already is IEEE-128 (__LONG_DOUBLE_IEEE128__) KIND=17 duplicates KIND=16, and unless USE_IEC_60559 is defined the *_r17.c files use the libquadmath *q entry points (jnq, fabsq, ...). When libquadmath is not configured (HAVE_FLOAT128 undefined) those are undeclared, so libgfortran fails to build with "implicit declaration of function 'jnq'" -- an error since GCC 14. Reproducible on FreeBSD 16 powerpc64le, which defaults long double to IEEE-128. Only define the separate _Float128 KIND=17 when long double is not already IEEE-128. libgfortran/ChangeLog: * kinds-override.h: Do not define REAL(KIND=17) when long double is already IEEE 128-bit (__LONG_DOUBLE_IEEE128__). Signed-off-by: Piotr Kubaj --- libgfortran/kinds-override.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgfortran/kinds-override.h b/libgfortran/kinds-override.h --- a/libgfortran/kinds-override.h +++ b/libgfortran/kinds-override.h @@ -30,7 +30,7 @@ #endif /* Keep these conditions on one line so grep can filter it out. */ -#if defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG_DOUBLE__ == 16 +#if defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG_DOUBLE__ == 16 && !defined(__LONG_DOUBLE_IEEE128__) typedef _Float128 GFC_REAL_17; typedef _Complex _Float128 GFC_COMPLEX_17; #define HAVE_GFC_REAL_17