From deda18bae8a38ec76c9366e227e3a2b8610ad697 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 8 Aug 2022 04:09:33 -0700 Subject: [PATCH] gcc: only pass --with-long-double-format if gcc allows it --- pkgs/development/compilers/gcc/common/platform-flags.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index 111af8ed430d..c0593cd781ed 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -14,7 +14,14 @@ in lib.concatLists [ (lib.optionals targetPlatform.isPower64 # musl explicitly rejects 128-bit long double on # powerpc64; see musl/arch/powerpc64/bits/float.h - (lib.optionals (!targetPlatform.isMusl) [ + (lib.optionals + (!targetPlatform.isMusl + && (targetPlatform.isLittleEndian || + # "... --with-long-double-format is only supported if the default cpu is power7 or newer" + # https://github.com/NixOS/nixpkgs/pull/170215#issuecomment-1202164709 + (lib.lists.elem + (lib.strings.substring 0 6 (p.cpu or "")) + [ "power7" "power8" "power9" "power1"/*0, 11, etc*/ ]))) [ "--with-long-double-128" "--with-long-double-format=${gcc.long-double-format or "ieee"}" ]))