Skip to content

Commit

Permalink
naive wip for sharing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
goertzenator committed Nov 22, 2018
1 parent f6e03ec commit 66754fb
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 6 deletions.
9 changes: 8 additions & 1 deletion lib/systems/doubles.nix
Expand Up @@ -12,11 +12,14 @@ let
"mipsel-linux"

"i686-cygwin" "i686-freebsd" "i686-linux" "i686-netbsd" "i686-openbsd"
"i586-cygwin" "i586-freebsd" "i586-linux" "i586-netbsd" "i586-openbsd"
"i486-cygwin" "i486-freebsd" "i486-linux" "i486-netbsd" "i486-openbsd"
"i386-cygwin" "i386-freebsd" "i386-linux" "i386-netbsd" "i386-openbsd"

"x86_64-cygwin" "x86_64-darwin" "x86_64-freebsd" "x86_64-linux"
"x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris"

"x86_64-windows" "i686-windows"
"x86_64-windows" "i686-windows" "i586-windows"
];

allParsed = map parse.mkSystemFromString all;
Expand All @@ -31,7 +34,11 @@ in rec {
arm = filterDoubles predicates.isAarch32;
aarch64 = filterDoubles predicates.isAarch64;
x86 = filterDoubles predicates.isx86;
i386 = filterDoubles predicates.isi386;
i486 = filterDoubles predicates.isi486;
i586 = filterDoubles predicates.isi586;
i686 = filterDoubles predicates.isi686;
x86_32 = filterDoubles predicates.isx86_32;
x86_64 = filterDoubles predicates.isx86_64;
mips = filterDoubles predicates.isMips;

Expand Down
4 changes: 4 additions & 0 deletions lib/systems/for-meta.nix
Expand Up @@ -12,7 +12,11 @@ in rec {
arm = [ patterns.isAarch32 ];
aarch64 = [ patterns.isAarch64 ];
x86 = [ patterns.isx86 ];
i386 = [ patterns.isi386 ];
i486 = [ patterns.isi486 ];
i586 = [ patterns.isi586 ];
i686 = [ patterns.isi686 ];
x86_32 = [ patterns.isx86_32 ];
x86_64 = [ patterns.isx86_64 ];
mips = [ patterns.isMips ];
riscv = [ patterns.isRiscV ];
Expand Down
6 changes: 5 additions & 1 deletion lib/systems/inspect.nix
Expand Up @@ -8,8 +8,12 @@ let abis = lib.mapAttrs (_: abi: builtins.removeAttrs abi [ "assertions" ]) abis

rec {
patterns = rec {
isi386 = { cpu = cpuTypes.i386; };
isi486 = { cpu = cpuTypes.i486; };
isi586 = { cpu = cpuTypes.i586; };
isi686 = { cpu = cpuTypes.i686; };
isx86_64 = { cpu = cpuTypes.x86_64; };
isx86_32 = { cpu = { family = "x86"; bits = 32; }; };
isx86_64 = { cpu = { family = "x86"; bits = 64; }; };
isPowerPC = { cpu = cpuTypes.powerpc; };
isPower = { cpu = { family = "power"; }; };
isx86 = { cpu = { family = "x86"; }; };
Expand Down
3 changes: 3 additions & 0 deletions lib/systems/parse.nix
Expand Up @@ -82,6 +82,9 @@ rec {
aarch64 = { bits = 64; significantByte = littleEndian; family = "arm"; version = "8"; };
aarch64_be = { bits = 64; significantByte = bigEndian; family = "arm"; version = "8"; };

i386 = { bits = 32; significantByte = littleEndian; family = "x86"; };
i486 = { bits = 32; significantByte = littleEndian; family = "x86"; };
i586 = { bits = 32; significantByte = littleEndian; family = "x86"; };

This comment has been minimized.

Copy link
@Ericson2314

Ericson2314 Nov 28, 2018

Try using version = "N"; here, like arm. Most uses don't need an exact x86 version, but either >= or <= (covariance or contravariance).

This comment has been minimized.

Copy link
@goertzenator

goertzenator Nov 29, 2018

Author Owner

I don't know, it's not obvious to me what the N should be or the actual use cases (If you know an ARM use-case that would apply to x86, I'd love to see it!). My compulsion is to wait until the use case emerges and then add something. For example, it may be that a flag field ends up making more sense (ie, hasMMX)

This comment has been minimized.

Copy link
@Ericson2314

Ericson2314 Nov 29, 2018

I was thinking just i386 -> 3, i486 -> 4, etc. hasMMX etc could be written in terms of those. Does that sound valid?

i686 = { bits = 32; significantByte = littleEndian; family = "x86"; };
x86_64 = { bits = 64; significantByte = littleEndian; family = "x86"; };

Expand Down
3 changes: 3 additions & 0 deletions lib/systems/platforms.nix
Expand Up @@ -467,6 +467,9 @@ rec {
};

selectBySystem = system: {
"i386-linux" = pc32;
"i486-linux" = pc32;
"i586-linux" = pc32;
"i686-linux" = pc32;
"x86_64-linux" = pc64;
"armv5tel-linux" = sheevaplug;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/bintools-wrapper/default.nix
Expand Up @@ -177,7 +177,7 @@ stdenv.mkDerivation {
/**/ if targetPlatform.isAarch64 then endianPrefix + "aarch64"
else if targetPlatform.isAarch32 then endianPrefix + "arm"
else if targetPlatform.isx86_64 then "x86-64"
else if targetPlatform.isi686 then "i386"
else if targetPlatform.isx86_32 then "i386"
else if targetPlatform.isMips then {
"mips" = "btsmipn32"; # n32 variant
"mipsel" = "ltsmipn32"; # n32 variant
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/7/default.nix
Expand Up @@ -289,7 +289,7 @@ stdenv.mkDerivation ({
optional (!bootstrap) "--disable-bootstrap" ++

# Platform-specific flags
optional (targetPlatform == hostPlatform && targetPlatform.isi686) "--with-arch=i686" ++
optional (targetPlatform == hostPlatform && targetPlatform.isx86_32) "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}" ++
optionals hostPlatform.isSunOS [
"--enable-long-long" "--enable-libssp" "--enable-threads=posix" "--disable-nls" "--enable-__cxa_atexit"
# On Illumos/Solaris GNU as is preferred
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/7/llvm.nix
Expand Up @@ -135,7 +135,7 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'';

doCheck = stdenv.isLinux && (!stdenv.isi686);
doCheck = stdenv.isLinux && (!stdenv.isx86_32);

checkTarget = "check-all";

Expand Down
2 changes: 1 addition & 1 deletion pkgs/os-specific/linux/kernel/common-config.nix
Expand Up @@ -432,7 +432,7 @@ let

VFIO_PCI_VGA = when stdenv.is64bit yes;

} // optionalAttrs (stdenv.isx86_64 || stdenv.isi686) ({
} // optionalAttrs stdenv.isx86 ({
XEN = option yes;

# XXX: why isn't this in the xen-dom0 conditional section below?
Expand Down

0 comments on commit 66754fb

Please sign in to comment.