From e20724603b6eb99d50a09fe2371b54b01dd4860d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Thu, 6 Jul 2023 16:26:09 +0100 Subject: [PATCH] disable rv64gc_zba_zba on gcc <11 and clang <14 --- nixpkgs/nixpkgs.patch | 120 +++++++++++++++++++++++++----------------- 1 file changed, 72 insertions(+), 48 deletions(-) diff --git a/nixpkgs/nixpkgs.patch b/nixpkgs/nixpkgs.patch index 05d7f6b..9b77d93 100644 --- a/nixpkgs/nixpkgs.patch +++ b/nixpkgs/nixpkgs.patch @@ -1,8 +1,8 @@ diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix -index 57b9184ca60..37d12ac687f 100644 +index 9be8c80e3f11..0d1e4c6dfb05 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix -@@ -32,9 +32,25 @@ rec { +@@ -41,9 +41,25 @@ rec { armv5te = [ ]; armv6 = [ ]; armv7-a = [ ]; @@ -27,9 +27,9 @@ index 57b9184ca60..37d12ac687f 100644 + rv64gc_zbb = []; + rv64gc_zba_zbb = []; }; - + # a superior CPU has all the features of an inferior and is able to build and test code for it -@@ -92,8 +108,24 @@ rec { +@@ -114,8 +130,24 @@ rec { armv6 = [ ]; armv7-a = [ ]; armv8-a = [ ]; @@ -52,54 +52,39 @@ index 57b9184ca60..37d12ac687f 100644 + rv64gc_zbb = [ "rv64gc" ] ++ inferiors.rv64gc; + rv64gc_zba_zbb = [ "rv64gc" "rv64gc_zba" "rv64gc_zbb" ]; }; - + predicates = let -diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix -index 4d847e280f4..874b776c1e1 100644 ---- a/pkgs/top-level/impure.nix -+++ b/pkgs/top-level/impure.nix -@@ -9,12 +9,15 @@ let - # Return ‘x’ if it evaluates, or ‘def’ if it throws an exception. - try = x: def: let res = builtins.tryEval x; in if res.success then res.value else def; - -+ configuredLocalSystem = if builtins.pathExists "/etc/nix/local-system.json" then builtins.fromJSON (builtins.readFile "/etc/nix/local-system.json") else { system = builtins.currentSystem; }; -+ localSystemOverriden = args: args ? system && (args.system != configuredLocalSystem); -+ defaultLocalSystem = args: if localSystemOverriden args then { system = args.system; } else configuredLocalSystem; - in - - { # We put legacy `system` into `localSystem`, if `localSystem` was not passed. - # If neither is passed, assume we are building packages on the current - # (build, in GNU Autotools parlance) platform. -- localSystem ? { system = args.system or builtins.currentSystem; } -+ localSystem ? null - - # These are needed only because nix's `--arg` command-line logic doesn't work - # with unnamed parameters allowed by ... -@@ -78,6 +81,9 @@ in - - , ... - } @ args: -+let -+ localSystem' = if localSystem == null then defaultLocalSystem args else localSystem; -+in - - # If `localSystem` was explicitly passed, legacy `system` should - # not be passed, and vice-versa. -@@ -85,5 +91,6 @@ assert args ? localSystem -> !(args ? system); - assert args ? system -> !(args ? localSystem); - - import ./. (builtins.removeAttrs args [ "system" ] // { -- inherit config overlays localSystem; -+ inherit config overlays; -+ localSystem = localSystem'; - }) +diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix +index db3efa068c0f..2e75895496a1 100644 +--- a/pkgs/build-support/cc-wrapper/default.nix ++++ b/pkgs/build-support/cc-wrapper/default.nix +@@ -128,6 +128,9 @@ let + znver2 = versionAtLeast ccVersion "9.0"; + znver3 = versionAtLeast ccVersion "11.0"; + znver4 = versionAtLeast ccVersion "13.0"; ++ ++ # Risc-V ++ rv64gc_zba_zbb = versionAtLeast ccVersion "11.0"; + }.${arch} or true + else if isClang then + { #Generic +@@ -147,6 +150,9 @@ let + znver2 = versionAtLeast ccVersion "9.0"; + znver3 = versionAtLeast ccVersion "12.0"; + znver4 = versionAtLeast ccVersion "16.0"; ++ ++ # Risc-V ++ rv64gc_zba_zbb = versionAtLeast ccVersion "14.0"; + }.${arch} or true + else + false; diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix -index 6cb494d46e5..f53cfde3bad 100644 +index 745426915987..cf731b618f0c 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix -@@ -165,10 +165,8 @@ let +@@ -166,10 +166,8 @@ let , ... } @ attrs: - + let - # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when - # no package has `doCheck = true`. @@ -107,6 +92,45 @@ index 6cb494d46e5..f53cfde3bad 100644 - doInstallCheck' = doInstallCheck && stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck' = config.doCheckByDefault && stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doInstallCheck' = config.doCheckByDefault && stdenv.buildPlatform.canExecute stdenv.hostPlatform; - + separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux; outputs' = outputs ++ lib.optional separateDebugInfo' "debug"; +diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix +index 4d847e280f4b..874b776c1e16 100644 +--- a/pkgs/top-level/impure.nix ++++ b/pkgs/top-level/impure.nix +@@ -9,12 +9,15 @@ let + # Return ‘x’ if it evaluates, or ‘def’ if it throws an exception. + try = x: def: let res = builtins.tryEval x; in if res.success then res.value else def; + ++ configuredLocalSystem = if builtins.pathExists "/etc/nix/local-system.json" then builtins.fromJSON (builtins.readFile "/etc/nix/local-system.json") else { system = builtins.currentSystem; }; ++ localSystemOverriden = args: args ? system && (args.system != configuredLocalSystem); ++ defaultLocalSystem = args: if localSystemOverriden args then { system = args.system; } else configuredLocalSystem; + in + + { # We put legacy `system` into `localSystem`, if `localSystem` was not passed. + # If neither is passed, assume we are building packages on the current + # (build, in GNU Autotools parlance) platform. +- localSystem ? { system = args.system or builtins.currentSystem; } ++ localSystem ? null + + # These are needed only because nix's `--arg` command-line logic doesn't work + # with unnamed parameters allowed by ... +@@ -78,6 +81,9 @@ in + + , ... + } @ args: ++let ++ localSystem' = if localSystem == null then defaultLocalSystem args else localSystem; ++in + + # If `localSystem` was explicitly passed, legacy `system` should + # not be passed, and vice-versa. +@@ -85,5 +91,6 @@ assert args ? localSystem -> !(args ? system); + assert args ? system -> !(args ? localSystem); + + import ./. (builtins.removeAttrs args [ "system" ] // { +- inherit config overlays localSystem; ++ inherit config overlays; ++ localSystem = localSystem'; + })