gcc: only pass --with-long-double-format if gcc allows it

This commit is contained in:
Adam Joseph 2022-08-08 04:09:33 -07:00
parent 29b395309f
commit deda18bae8

View File

@ -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"}"
]))