FreeBSD 16 switched the powerpc64le base ABI to IEEE binary128 for long
double (matching powerpc64le-linux).  For GCC to be ABI-compatible with
the FreeBSD system it must likewise default long double to IEEE-128 and
build/emit the supporting IEEE-128 runtime.  GCC already does all of this
on powerpc64le-linux; this series wires FreeBSD into the same paths.

1-2  default long double to IEEE-128 (config.gcc, configure).
3-4  build the KFmode libgcc helpers and, since FreeBSD has no float128
     IFUNC, export the software ones from libgcc_s.so.
5-6  two glibc assumptions that break any non-glibc IEEE-128 target: the
     rs6000 long-double built-in name remap and the libgfortran kind-17
     remap both hard-code glibc entry points; gate them on glibc.
7    a general libgfortran build bug that any IEEE-128 long double target
     hits; independent of the rest.

Tested by building current master on powerpc64le-unknown-freebsd16.0:
builds to completion, long double defaults to IEEE binary128, libgcc_s.so
exports the __*kf* helpers, and ports that link against them build and
link (biology/star, math/blas).
Also verified inert on FreeBSD 15.1 (64-bit long double): the float128
machinery stays gated off and gcc builds unchanged.

Piotr Kubaj (7):
  rs6000: default long double to IEEE 128-bit on powerpc*le
  configure: accept --with-long-double-format on powerpc64le-*-freebsd*
  libgcc: build the float128 support functions on powerpc*-*-freebsd*
  libgcc: build and export the float128 helpers for powerpc64*-*-freebsd*
  rs6000: only remap long double built-ins to __*ieee128 with glibc
  fortran: only apply the IEEE-128 long double kind remap with glibc
  libgfortran: don't add REAL(KIND=17) when long double is IEEE 128-bit

 gcc/config.gcc                                   | 5 ++++-
 gcc/configure.ac                                 | 3 ++-
 libgcc/configure.ac                              | 5 +++--
 libgcc/config.host                               | 6 ++++++
 libgcc/config/rs6000/t-float128-freebsd          | 15 +++++++++++++++
 libgcc/config/rs6000/libgcc-freebsd-float128.ver | 35 
+++++++++++++++++++++++++++++++++++
 gcc/config/rs6000/rs6000.cc                      | 1 +
 gcc/fortran/trans-types.cc                       | 3 ++-
 libgfortran/kinds-override.h                     | 2 +-
 9 files changed, 69 insertions(+), 6 deletions(-)

-- 
2.49.0

Reply via email to