git.iko.soy/typeable/nixpkgs
on master help sign in
lib: Clean up float/fpu options

ARM ABIs now have a float field. This is used as a fallback to lessen our use of `platform.gcc.float`. I didn't know what the MIPs convention is so I kept using `platform.gcc.float` in that case.

commit1fe81a4bcd25dba9319bc1bb49b078872f28ffa6 authorJohn Ericson <John.Ericson@Obsidian.Systems> dateThu 10 May 2018, 17:31 (9 years ago) parentc9f6a82
5 files changed+25−29
lib/systems/examples.nix+1−8 lib/systems/parse.nix+18−14 lib/systems/platforms.nix+1−5 pkgs/development/compilers/gcc/common/platform-flags.nix+2−1 pkgs/development/libraries/glibc/common.nix+3−1
lib/systems/examples.nix+1−8
@@ -11,21 +11,16 @@ rec {
1111
1212 sheevaplug = rec {
1313 config = "armv5tel-unknown-linux-gnueabi";
14− float = "soft";
1514 platform = platforms.sheevaplug;
1615 };
1716
1817 raspberryPi = rec {
1918 config = "armv6l-unknown-linux-gnueabihf";
20− float = "hard";
21− fpu = "vfp";
2219 platform = platforms.raspberrypi;
2320 };
2421
2522 armv7l-hf-multiplatform = rec {
2623 config = "armv7a-unknown-linux-gnueabihf";
27− float = "hard";
28− fpu = "vfpv3-d16";
2924 platform = platforms.armv7l-hf-multiplatform;
3025 };
3126
@@ -47,26 +42,24 @@ rec {
4742
4843 pogoplug4 = rec {
4944 config = "armv5tel-unknown-linux-gnueabi";
50− float = "soft";
5145 platform = platforms.pogoplug4;
5246 };
5347
5448 ben-nanonote = rec {
5549 config = "mipsel-unknown-linux-uclibc";
56− float = "soft";
5750 platform = {
5851 name = "ben_nanonote";
5952 kernelMajor = "2.6";
6053 kernelArch = "mips";
6154 gcc = {
6255 arch = "mips32";
56+ float = "soft";
6357 };
6458 };
6559 };
6660
6761 fuloongminipc = rec {
6862 config = "mipsel-unknown-linux-gnu";
69− float = "hard";
7063 platform = platforms.fuloong2f_n32;
7164 };
7265
lib/systems/parse.nix+18−14
@@ -182,20 +182,24 @@ rec {
182182 types.abi = enum (attrValues abis);
183183
184184 abis = setTypes types.openAbi {
185− android = {};
186− cygnus = {};
187− gnu = {};
188− msvc = {};
189− eabi = {};
190− androideabi = {};
191− gnueabi = {};
192− gnueabihf = {};
193− musleabi = {};
194− musleabihf = {};
195− musl = {};
196− uclibceabihf = {};
197− uclibceabi = {};
198− uclibc = {};
185+ cygnus = {};
186+ msvc = {};
187+ eabi = {};
188+
189+ androideabi = {};
190+ android = {};
191+
192+ gnueabi = { float = "soft"; };
193+ gnueabihf = { float = "hard"; };
194+ gnu = {};
195+
196+ musleabi = { float = "soft"; };
197+ musleabihf = { float = "hard"; };
198+ musl = {};
199+
200+ uclibceabihf = { float = "soft"; };
201+ uclibceabi = { float = "hard"; };
202+ uclibc = {};
199203
200204 unknown = {};
201205 };
lib/systems/platforms.nix+1−5
@@ -25,7 +25,6 @@ rec {
2525
2626 gcc = {
2727 arch = "armv5te";
28− float = "soft";
2928 };
3029
3130 kernelMajor = "2.6";
@@ -158,7 +157,6 @@ rec {
158157 kernelDTB = true; # Beyond 3.10
159158 gcc = {
160159 arch = "armv5te";
161− float = "soft";
162160 };
163161 };
164162
@@ -336,7 +334,6 @@ rec {
336334 gcc = {
337335 cpu = "cortex-a9";
338336 fpu = "vfpv3";
339− float = "hard";
340337 };
341338 };
342339
@@ -363,7 +360,6 @@ rec {
363360 gcc = {
364361 cpu = "cortex-a9";
365362 fpu = "neon";
366− float = "hard";
367363 };
368364 };
369365
@@ -449,6 +445,7 @@ rec {
449445 kernelTarget = "vmlinux";
450446 gcc = {
451447 arch = "loongson2f";
448+ float = "hard";
452449 abi = "n32";
453450 };
454451 };
@@ -498,7 +495,6 @@ rec {
498495 # and the above page suggests NEON is only an improvement with hand-written assembly.
499496 arch = "armv7-a";
500497 fpu = "vfpv3-d16";
501− float = "hard";
502498
503499 # For Raspberry Pi the 2 the best would be:
504500 # cpu = "cortex-a7";
pkgs/development/compilers/gcc/common/platform-flags.nix+2−1
@@ -2,11 +2,12 @@
22
33let
44 p = targetPlatform.platform.gcc or {};
5+ float = p.float or (targetPlatform.parsed.abi.float or null);
56in lib.concatLists [
67 (lib.optional (p ? arch) "--with-arch=${p.arch}")
78 (lib.optional (p ? cpu) "--with-cpu=${p.cpu}")
89 (lib.optional (p ? abi) "--with-abi=${p.abi}")
910 (lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
10− (lib.optional (p ? float) "--with-float=${p.float}")
11+ (lib.optional (float != null) "--with-float=${float}")
1112 (lib.optional (p ? mode) "--with-mode=${p.mode}")
1213]
pkgs/development/libraries/glibc/common.nix+3−1
@@ -127,7 +127,9 @@ stdenv.mkDerivation ({
127127 ] ++ lib.optionals withLinuxHeaders [
128128 "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26
129129 ] ++ lib.optionals (cross != null) [
130− (if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp")
130+ (if cross.platform.gcc.float or (cross.parsed.abi.float or "hard") == "soft"
131+ then "--without-fp"
132+ else "--with-fp")
131133 ] ++ lib.optionals (cross != null) [
132134 "--with-__thread"
133135 ] ++ lib.optionals (cross == null && stdenv.isAarch32) [