From 40f7300227019403d00965fc37709149ba4eadca Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 25 Apr 2022 00:00:11 -0700 Subject: [PATCH] gcc: if isPower64 && !isMusl use --with-long-double-format=ieee Use IEEE-standard floating point on `powerpc64le` instead of IBM-proprietary formats. The GCC wiki has more details on the history here: https://gcc.gnu.org/wiki/Ieee128PowerPC Nixpkgs' stdenv has no legacy `powerpc64le` installs to deal with (stdenv did not bootstrap on powerpc64le until very recenty), so it's much easier decision for us. Red Hat (i.e. IBM) has tried to do this in each of the last *six* releases: https://fedoraproject.org/wiki/Changes/PPC64LE_Float128_Transition they and finally shipped it in May with Fedora 36: https://bugzilla.redhat.com/show_bug.cgi?id=1649936 Apparently glibc 2.35 fixes the last blocker. Co-authored-by: Sandro --- .../compilers/gcc/common/platform-flags.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index bd5a72f96036..fc068c194d2b 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -10,7 +10,11 @@ in lib.concatLists [ (lib.optional (p ? fpu) "--with-fpu=${p.fpu}") (lib.optional (p ? float) "--with-float=${p.float}") (lib.optional (p ? mode) "--with-mode=${p.mode}") - (lib.optional - (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit) - "--with-long-double-128") + (lib.optionals targetPlatform.isPower64 + # musl explicitly rejects 128-bit long double on + # powerpc64; see musl/arch/powerpc64/bits/float.h + (lib.optionals (!targetPlatform.isMusl) [ + "--with-long-double-128" + "--with-long-double-format=ieee" + ])) ]