Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generic x86_32 support #52634

Merged
merged 3 commits into from Jan 6, 2019
Merged

Conversation

goertzenator
Copy link
Contributor

Motivation for this change

Add support for i386-i586. Ref:

In summary:

  • Add isx86_32 predicate that can replace most uses of isi686.
  • isi686 is reinterpreted to mean "exactly i686 arch, and not say i585 or i386".
  • This branch was used to build working i586 kernel running on i586 hardware.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

- Add support for i386-i586.
- Add `isx86_32` predicate that can replace most uses of `isi686`.
- `isi686` is reinterpreted to mean "exactly i686 arch, and not say i585 or i386".
- This branch was used to build working i586 kernel running on i586 hardware.
@nixos-discourse
Copy link

This pull request has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/i586-cross-compiling-ambiguous-i686-use/1482/8

@@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i386 doesn't work with latest glibc - better leave it off

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I purge all i386 support from the PR or just this i386 line?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the i386-linux references, I think. Although I'm not sure whether other OSs actually still support i386. Very few computers still even exist that are i386 so it's largely a irrelevant 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've followed code to see what doubles.nix actually does, and... it does almost nothing. Only mesaPlatforms appears to be used AFAICT. Anyway I will revert all changes to this file and also for-meta.nix (which looks 100% dead).

@@ -8,8 +8,12 @@ let abis = lib.mapAttrs (_: abi: builtins.removeAttrs abi [ "assertions" ]) abis

rec {
patterns = rec {
isi386 = { cpu = cpuTypes.i386; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect needing these? My thinking would be we would just use x86_32 as much as possible. We are doing a similar thing with isAarch32 as well. Even without these you can always do:

stdenv.hostPlatform.parsed.cpu.name == "i386"

if you really need a condition on a certain micro architecture.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't. I put them in to be symmetric with isi686.

- Remove changes to dead code in `doubles.nix` and `for-meta.nix`.
- Remove `isi[345]86` predicates since other cpu families don't have specific model predicates.
@matthewbauer matthewbauer merged commit 1c10efc into NixOS:staging Jan 6, 2019
isi686 isx86_64 is64bit isAarch32 isAarch64 isMips isBigEndian;
isi386 isi486 isi586 isi686 isx86_32 isx86_64
is32bit is64bit
isAarch32 isAarch64 isMips isBigEndian;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I was trying to not grow this in preference of people using stdenv.hostPlatform.is*. Let others decide whether that's a good goal. It's certainly not our worst source of duplication.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also sorry I wrote this (probably on my phone) and then never submitted it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to remove them. At some point we should probably just start removing any stdenv.is* that is unused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants