summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-09 18:50:51 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-10 15:05:23 -0400
commit58b2e875c212f10129a2320f38f03988dee13bed (patch)
tree52aba60b8852e7574695dba2c69c3cbca9e20d74 /lib
parent4ae207aea0164caee9c39b24177692ab4ef4dab4 (diff)
downloadnixpkgs-58b2e875c212f10129a2320f38f03988dee13bed.tar
nixpkgs-58b2e875c212f10129a2320f38f03988dee13bed.tar.gz
nixpkgs-58b2e875c212f10129a2320f38f03988dee13bed.tar.bz2
nixpkgs-58b2e875c212f10129a2320f38f03988dee13bed.tar.lz
nixpkgs-58b2e875c212f10129a2320f38f03988dee13bed.tar.xz
nixpkgs-58b2e875c212f10129a2320f38f03988dee13bed.tar.zst
nixpkgs-58b2e875c212f10129a2320f38f03988dee13bed.zip
lib/systems: Prohibit "gnu" ABI (*-gnu) with 32-bit ARM
It is ambiguous, and therefore banned within GCC.
Diffstat (limited to 'lib')
-rw-r--r--lib/systems/default.nix7
-rw-r--r--lib/systems/parse.nix12
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index 0e1a10c1f64..ee4c29660a5 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -50,5 +50,12 @@ rec {
     } // mapAttrs (n: v: v final.parsed) inspect.predicates
       // args;
   in assert final.useAndroidPrebuilt -> final.isAndroid;
+     assert lib.foldl
+       (pass: { assertion, message }:
+         if assertion final
+         then pass
+         else throw message)
+       true
+       (final.parsed.abi.assertions or []);
     final;
 }
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix
index 16d657a5435..08f2fb445de 100644
--- a/lib/systems/parse.nix
+++ b/lib/systems/parse.nix
@@ -192,7 +192,15 @@ rec {
   abis = setTypes types.openAbi {
     android = {};
     cygnus = {};
-    gnu = {};
+    gnu = {
+      assertions = [
+        { assertion = platform: !platform.isAarch32;
+          message = ''
+            The "gnu" ABI is ambiguous on 32-bit ARM. Use "gnueabi" or "gnueabihf" instead.
+          '';
+        }
+      ];
+    };
     msvc = {};
     eabi = {};
     androideabi = {};
@@ -270,7 +278,7 @@ rec {
       kernel = getKernel args.kernel;
       abi =
         /**/ if args ? abi       then getAbi args.abi
-        else if isLinux   parsed then abis.gnu
+        else if isLinux   parsed then (if isAarch32 parsed then abis.gnueabi else abis.gnu)
         else if isWindows parsed then abis.gnu
         else                     abis.unknown;
     };