Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Feb 21, 2022

This PR adds an additional two-line patch to the code which calculates a hostPlatform based on the builtins.system provided by the nix interpreter, which is in turn derived from the runtime CPU.

If the runtime CPU is a 64-bit mips chip running on a little-endian kernel, and the user has not specified otherwise, this commit will cause nixpkgs to assume the "n64" ABI.

All mips64 chips are capable of supporting all the mips ABIs.

The n64 ABI was chosen because boost's user-scheduled threading (which nix requires) currently does not support the n32 ABI -- it lacks the assembler file which explains how to save and restore the processor state for that ABI. This is also the ABI that Debian has chosen for this platform.

Things done

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Feb 21, 2022
@ghost ghost requested review from edolstra and infinisil as code owners February 21, 2022 05:17
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 21, 2022
@ghost
Copy link
Author

ghost commented Feb 23, 2022

Latest push rebases against #161158 ; no other changes.

@ghost
Copy link
Author

ghost commented Mar 3, 2022

Latest push rebases against #161158; no other changes.

@ghost
Copy link
Author

ghost commented Mar 4, 2022

Latest push rebases on #161158, no other changes.

@ofborg ofborg bot added the 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. label Mar 4, 2022
@ofborg ofborg bot requested a review from Ma27 March 4, 2022 21:46
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Mar 4, 2022
@ghost ghost changed the base branch from master to staging March 5, 2022 08:10
@ghost ghost requested review from Mic92, kalbasit and zowoq as code owners March 18, 2022 02:14
@github-actions github-actions bot added 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. and removed 6.topic: stdenv Standard environment labels Mar 18, 2022
@ghost ghost changed the base branch from staging to master March 18, 2022 02:15
@github-actions github-actions bot removed the 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. label Mar 18, 2022
@ghost
Copy link
Author

ghost commented Mar 18, 2022

Rebased. #161158 has merged, so this PR is useful now.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. and removed 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Mar 18, 2022
@Mic92
Copy link
Member

Mic92 commented Mar 20, 2022

It looks like some platforms you added don't evaluate. This problem is also present on master. I noticed this in nix-community/cross-toolchains.nix#19 as well

╭─[~/git/nixpkgs]─[mips64el-detection]
╰─ % nix repl .
Welcome to Nix 2.7.0. Type :? for help.

Loading '.'...
Added 16108 variables.

nix-repl> pkgsCross.mipsisa32r6-linux-gnu
error: Unknown CPU type: mipsisa32r6

@ghost
Copy link
Author

ghost commented Mar 21, 2022

error: Unknown CPU type: mipsisa32r6

This is not expected to evaluate, as explained here and here.

@ghost ghost changed the title mips64: have 64-bit mips chips auto-detect little-endian abi=n64 mips64: have mips64el chips auto-detect abi=n64 Apr 6, 2022
This PR adds an additional two-line patch to the code which calculates
a `hostPlatform` based on the `builtins.system` provided by the `nix`
interpreter, which is in turn derived from the runtime CPU.

If the runtime CPU is a 64-bit mips chip running on a little-endian
kernel, and the user has not specified otherwise, this commit will
cause nixpkgs to assume the "n64" ABI.

All mips64 chips are capable of supporting all the mips ABIs.

The n64 ABI was chosen because boost's user-scheduled threading (which
nix requires) currently does not support the n32 ABI -- it lacks the
assembler file which explains how to save and restore the processor
state for that ABI.  This is also the ABI that Debian has chosen for
this platform.
@ghost
Copy link
Author

ghost commented Apr 6, 2022

Rebased and commit comment updated to clarify that assumptions are being introduced only for the ABI. The CPU type is detected by the nix interpreter and the endianness comes from the OS kernel.

Also clarifies that the ABI choice is the same one Debian uses.

@ghost ghost mentioned this pull request Jul 5, 2022
3 tasks
@ghost ghost marked this pull request as draft August 6, 2022 20:25
@ghost ghost closed this Oct 22, 2023
@ghost ghost deleted the mips64el-detection branch October 22, 2023 07:40
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant