git: 185a03ad8aa8 - main - libgcc_s: export the IEEE-128 long double runtime on powerpc64le

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Sun, 09 Aug 2026 09:07:40 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/src/commit/?id=185a03ad8aa84baf6c644688fc7687d2a3ebf1c5

commit 185a03ad8aa84baf6c644688fc7687d2a3ebf1c5
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-08-09 09:02:40 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-08-09 09:07:30 +0000

    libgcc_s: export the IEEE-128 long double runtime on powerpc64le
    
    On powerpc64le with IEEE-128 long double, the long-double compiler-runtime
    helpers are the *kf* soft-float functions (built from the tf sources,
    renamed via -D in lib/libcompiler_rt/Makefile.inc) plus the complex
    multc3/__divtc3. They are compiled into libgcc_s.so by the powerpc64le
    SRCF block, but were never added to Symbol.map, so they stayed local and
    unexported.
    
    Every other IEEE-128 architecture already exports its scalar long-double
    runtime -- aarch64 and riscv list the tf helpers in GCC_4.6.0. powerpc64le
    was simply missed.
    
    Because the helpers are unexported, any clang-built shared library that uses
    long double leaves them undefined (permitted in a DSO), and linking an
    executable against that DSO then fails under lld's default
    --no-allow-shlib-undefined. For example science/harminv fails to link its
    binary against its own libharminv.so with undefined multc3/divtc3; at
    -O0, mulkf3/addkf3/__subkf3/__unordkf2 appear as well.
    
    Export the full runtime, gated on the PowerPC-specific LONG_DOUBLE_IEEE128
    predefine so no other architecture is affected: complex multc3/divtc3 in
    GCC_4.0.0 (beside the other complex mul*c3), and the 28 scalar *kf*
    functions in GCC_7.0.0. Node placement follows glibc/gcc symbol-versioning
    history.
    
    Differential Revision:  https://reviews.freebsd.org/D58248
---
 lib/libgcc_s/Symbol.map | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/lib/libgcc_s/Symbol.map b/lib/libgcc_s/Symbol.map
index 91fdeac3f2cf..ba656383bd5c 100644
--- a/lib/libgcc_s/Symbol.map
+++ b/lib/libgcc_s/Symbol.map
@@ -161,6 +161,10 @@ GCC_4.0.0 {
 	__mulsc3;
 #if defined(__amd64__) || defined(__i386__)
 	__mulxc3;
+#endif
+#if defined(__LONG_DOUBLE_IEEE128__)
+	__divtc3;
+	__multc3;
 #endif
 	__powidf2;
 	__powisf2;
@@ -233,4 +237,34 @@ GCC_7.0.0 {
 #ifdef __i386__
 	__divmoddi4;
 #endif
+#if defined(__LONG_DOUBLE_IEEE128__)
+	__addkf3;
+	__subkf3;
+	__mulkf3;
+	__divkf3;
+	__eqkf2;
+	__gekf2;
+	__gtkf2;
+	__lekf2;
+	__ltkf2;
+	__nekf2;
+	__unordkf2;
+	__extendsfkf2;
+	__extenddfkf2;
+	__trunckfsf2;
+	__trunckfdf2;
+	__fixkfsi;
+	__fixkfdi;
+	__fixkfti;
+	__fixunskfsi;
+	__fixunskfdi;
+	__fixunskfti;
+	__floatsikf;
+	__floatdikf;
+	__floattikf;
+	__floatunsikf;
+	__floatundikf;
+	__floatuntikf;
+	__powikf2;
+#endif
 };