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 +}