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.
This commit is contained in:
John Ericson 2018-05-10 17:31:07 -04:00
parent c9f6a82b61
commit 1fe81a4bcd
5 changed files with 25 additions and 29 deletions

View File

@ -11,21 +11,16 @@ rec {
sheevaplug = rec { sheevaplug = rec {
config = "armv5tel-unknown-linux-gnueabi"; config = "armv5tel-unknown-linux-gnueabi";
float = "soft";
platform = platforms.sheevaplug; platform = platforms.sheevaplug;
}; };
raspberryPi = rec { raspberryPi = rec {
config = "armv6l-unknown-linux-gnueabihf"; config = "armv6l-unknown-linux-gnueabihf";
float = "hard";
fpu = "vfp";
platform = platforms.raspberrypi; platform = platforms.raspberrypi;
}; };
armv7l-hf-multiplatform = rec { armv7l-hf-multiplatform = rec {
config = "armv7a-unknown-linux-gnueabihf"; config = "armv7a-unknown-linux-gnueabihf";
float = "hard";
fpu = "vfpv3-d16";
platform = platforms.armv7l-hf-multiplatform; platform = platforms.armv7l-hf-multiplatform;
}; };
@ -47,26 +42,24 @@ rec {
pogoplug4 = rec { pogoplug4 = rec {
config = "armv5tel-unknown-linux-gnueabi"; config = "armv5tel-unknown-linux-gnueabi";
float = "soft";
platform = platforms.pogoplug4; platform = platforms.pogoplug4;
}; };
ben-nanonote = rec { ben-nanonote = rec {
config = "mipsel-unknown-linux-uclibc"; config = "mipsel-unknown-linux-uclibc";
float = "soft";
platform = { platform = {
name = "ben_nanonote"; name = "ben_nanonote";
kernelMajor = "2.6"; kernelMajor = "2.6";
kernelArch = "mips"; kernelArch = "mips";
gcc = { gcc = {
arch = "mips32"; arch = "mips32";
float = "soft";
}; };
}; };
}; };
fuloongminipc = rec { fuloongminipc = rec {
config = "mipsel-unknown-linux-gnu"; config = "mipsel-unknown-linux-gnu";
float = "hard";
platform = platforms.fuloong2f_n32; platform = platforms.fuloong2f_n32;
}; };

View File

@ -182,20 +182,24 @@ rec {
types.abi = enum (attrValues abis); types.abi = enum (attrValues abis);
abis = setTypes types.openAbi { abis = setTypes types.openAbi {
android = {}; cygnus = {};
cygnus = {}; msvc = {};
gnu = {}; eabi = {};
msvc = {};
eabi = {}; androideabi = {};
androideabi = {}; android = {};
gnueabi = {};
gnueabihf = {}; gnueabi = { float = "soft"; };
musleabi = {}; gnueabihf = { float = "hard"; };
musleabihf = {}; gnu = {};
musl = {};
uclibceabihf = {}; musleabi = { float = "soft"; };
uclibceabi = {}; musleabihf = { float = "hard"; };
uclibc = {}; musl = {};
uclibceabihf = { float = "soft"; };
uclibceabi = { float = "hard"; };
uclibc = {};
unknown = {}; unknown = {};
}; };

View File

@ -25,7 +25,6 @@ rec {
gcc = { gcc = {
arch = "armv5te"; arch = "armv5te";
float = "soft";
}; };
kernelMajor = "2.6"; kernelMajor = "2.6";
@ -158,7 +157,6 @@ rec {
kernelDTB = true; # Beyond 3.10 kernelDTB = true; # Beyond 3.10
gcc = { gcc = {
arch = "armv5te"; arch = "armv5te";
float = "soft";
}; };
}; };
@ -336,7 +334,6 @@ rec {
gcc = { gcc = {
cpu = "cortex-a9"; cpu = "cortex-a9";
fpu = "vfpv3"; fpu = "vfpv3";
float = "hard";
}; };
}; };
@ -363,7 +360,6 @@ rec {
gcc = { gcc = {
cpu = "cortex-a9"; cpu = "cortex-a9";
fpu = "neon"; fpu = "neon";
float = "hard";
}; };
}; };
@ -449,6 +445,7 @@ rec {
kernelTarget = "vmlinux"; kernelTarget = "vmlinux";
gcc = { gcc = {
arch = "loongson2f"; arch = "loongson2f";
float = "hard";
abi = "n32"; abi = "n32";
}; };
}; };
@ -498,7 +495,6 @@ rec {
# and the above page suggests NEON is only an improvement with hand-written assembly. # and the above page suggests NEON is only an improvement with hand-written assembly.
arch = "armv7-a"; arch = "armv7-a";
fpu = "vfpv3-d16"; fpu = "vfpv3-d16";
float = "hard";
# For Raspberry Pi the 2 the best would be: # For Raspberry Pi the 2 the best would be:
# cpu = "cortex-a7"; # cpu = "cortex-a7";

View File

@ -2,11 +2,12 @@
let let
p = targetPlatform.platform.gcc or {}; p = targetPlatform.platform.gcc or {};
float = p.float or (targetPlatform.parsed.abi.float or null);
in lib.concatLists [ in lib.concatLists [
(lib.optional (p ? arch) "--with-arch=${p.arch}") (lib.optional (p ? arch) "--with-arch=${p.arch}")
(lib.optional (p ? cpu) "--with-cpu=${p.cpu}") (lib.optional (p ? cpu) "--with-cpu=${p.cpu}")
(lib.optional (p ? abi) "--with-abi=${p.abi}") (lib.optional (p ? abi) "--with-abi=${p.abi}")
(lib.optional (p ? fpu) "--with-fpu=${p.fpu}") (lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
(lib.optional (p ? float) "--with-float=${p.float}") (lib.optional (float != null) "--with-float=${float}")
(lib.optional (p ? mode) "--with-mode=${p.mode}") (lib.optional (p ? mode) "--with-mode=${p.mode}")
] ]

View File

@ -127,7 +127,9 @@ stdenv.mkDerivation ({
] ++ lib.optionals withLinuxHeaders [ ] ++ lib.optionals withLinuxHeaders [
"--enable-kernel=3.2.0" # can't get below with glibc >= 2.26 "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26
] ++ lib.optionals (cross != null) [ ] ++ lib.optionals (cross != null) [
(if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp") (if cross.platform.gcc.float or (cross.parsed.abi.float or "hard") == "soft"
then "--without-fp"
else "--with-fp")
] ++ lib.optionals (cross != null) [ ] ++ lib.optionals (cross != null) [
"--with-__thread" "--with-__thread"
] ++ lib.optionals (cross == null && stdenv.isAarch32) [ ] ++ lib.optionals (cross == null && stdenv.isAarch32) [