From 0a71bbb64a89b311d9b5a715de2f1713368e799f Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 4 Jun 2024 19:17:21 +0100 Subject: gcc: fix building with gcc.cpu on some platforms This fixes, for example, cross compiling to { system = "riscv64-linux"; gcc.cpu = "sifive-u74"; }. --- pkgs/development/compilers/gcc/common/platform-flags.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index cc6a67d640578..9bcdb3070d6b9 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -8,8 +8,9 @@ let in lib.concatLists [ # --with-arch= is unknown flag on x86_64 and aarch64-darwin. (lib.optional (!targetPlatform.isx86_64 && !isAarch64Darwin && p ? arch) "--with-arch=${p.arch}") + # See supported_defaults in gcc/config.gcc for architecture support. # --with-cpu on aarch64-darwin fails with "Unknown cpu used in --with-cpu=apple-a13". - (lib.optional (!isAarch64Darwin && p ? cpu) "--with-cpu=${p.cpu}") + (lib.optional (with targetPlatform; !isLoongArch64 && !isMips && !isRiscV && !isS390 && !isAarch64Darwin && p ? cpu) "--with-cpu=${p.cpu}") (lib.optional (p ? abi) "--with-abi=${p.abi}") (lib.optional (p ? fpu) "--with-fpu=${p.fpu}") (lib.optional (p ? float) "--with-float=${p.float}") -- cgit 1.4.1