lib: Fix float handling for Aarch32

Forgot to adjust default so abi with explicit float attr would be used.
This commit is contained in:
John Ericson 2018-05-12 15:07:31 -04:00
parent 6f40d18d44
commit f2004e6287
4 changed files with 23 additions and 19 deletions

View File

@ -68,17 +68,17 @@ rec {
cpuTypes = with significantBytes; setTypes types.openCpuType {
arm = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv5tel = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv6m = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv6l = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv7a = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv7r = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv7m = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv7l = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv8a = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv8r = { bits = 32; significantByte = littleEndian; family = "arm"; };
armv8m = { bits = 32; significantByte = littleEndian; family = "arm"; };
aarch64 = { bits = 64; significantByte = littleEndian; family = "arm"; };
armv5tel = { bits = 32; significantByte = littleEndian; family = "arm"; version = "5"; };
armv6m = { bits = 32; significantByte = littleEndian; family = "arm"; version = "6"; };
armv6l = { bits = 32; significantByte = littleEndian; family = "arm"; version = "6"; };
armv7a = { bits = 32; significantByte = littleEndian; family = "arm"; version = "7"; };
armv7r = { bits = 32; significantByte = littleEndian; family = "arm"; version = "7"; };
armv7m = { bits = 32; significantByte = littleEndian; family = "arm"; version = "7"; };
armv7l = { bits = 32; significantByte = littleEndian; family = "arm"; version = "7"; };
armv8a = { bits = 32; significantByte = littleEndian; family = "arm"; version = "8"; };
armv8r = { bits = 32; significantByte = littleEndian; family = "arm"; version = "8"; };
armv8m = { bits = 32; significantByte = littleEndian; family = "arm"; version = "8"; };
aarch64 = { bits = 64; significantByte = littleEndian; family = "arm"; version = "8"; };
i686 = { bits = 32; significantByte = littleEndian; family = "x86"; };
x86_64 = { bits = 64; significantByte = littleEndian; family = "x86"; };
@ -271,7 +271,12 @@ 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
if lib.versionAtLeast (parsed.cpu.version or "0") "6"
then abis.gnueabihf
else abis.gnueabi
else abis.gnu
else if isWindows parsed then abis.gnu
else abis.unknown;
};

View File

@ -245,7 +245,6 @@ rec {
gcc = {
arch = "armv6";
fpu = "vfp";
float = "hard";
# TODO(@Ericson2314) what is this and is it a good idea? It was
# used in some cross compilation examples but not others.
#

View File

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

View File

@ -65,14 +65,14 @@ rec {
bintools = binutils;
libc = targetAndroidndkPkgs.libraries;
extraBuildCommands = lib.optionalString targetPlatform.isAarch32 (let
p = targetPlatform.platform.gcc or {};
float = p.float or (targetPlatform.parsed.abi.float or null);
p = targetPlatform.platform.gcc or {}
// targetPlatform.parsed.abi;
flags = lib.concatLists [
(lib.optional (p ? arch) "-march=${p.arch}")
(lib.optional (p ? cpu) "-mcpu=${p.cpu}")
(lib.optional (p ? abi) "-mabi=${p.abi}")
(lib.optional (p ? fpu) "-mfpu=${p.fpu}")
(lib.optional (float != null) "-mfloat=${float}")
(lib.optional (p ? float) "-mfloat=${p.float}")
(lib.optional (p ? float-abi) "-mfloat-abi=${p.float-abi}")
(lib.optional (p ? mode) "-mmode=${p.mode}")
];