Skip to content

build-support/rust: toTargetArch: strip off endianness#187841

Merged
lovesegfault merged 1 commit intomasterfrom
unknown repository
Aug 25, 2022
Merged

build-support/rust: toTargetArch: strip off endianness#187841
lovesegfault merged 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Aug 22, 2022

Description of changes

toTargetArch in pkgs/build-support/rust/lib/default.nix is used to set CARGO_CFG_TARGET_ARCH. This environment variable is supposed to be the <arch> portion of an LLVM-style platform name:

<arch><sub>-<kernel>-<libc><abi>

Note that the pointer-width (the "64" in "x86_64" and "mips64") is part of <arch>, but the endianness (the _be in aarch64_be) is not.

Unfortunately at the moment nixpkgs' parsed cpuType has no way to query for the three subparts (name, pointer-width, and subarch/endianness), nor any way to ask for just the first two parts.

For now, this commit simply fixes the problem in the two cases that matter: mips64el and powerpc64le, which I believe are the only two platforms supported by both rust and nixpkgs which have a "subarchitecture".

Things done
  • Built on platform(s)
    • powerpc64le-linux
  • Tested compilation of one packages that depend on this change: ring
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@ghost ghost requested a review from zowoq as a code owner August 22, 2022 09:25
@github-actions github-actions bot added the 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. label Aug 22, 2022
`toTargetArch` in `pkgs/build-support/rust/lib/default.nix` is used to
set `CARGO_CFG_TARGET_ARCH`.  This environment variable is supposed to
be the `<arch>` portion of an LLVM-style platform name:

```
<arch><sub>-<kernel>-<libc><abi>
```

Note that the pointer-width (the "64" in "x86_64" and "mips64") is
part of `<arch>`, but the endianness (the `_be` in `aarch64_be`) is
*not*.

Unfortunately at the moment nixpkgs' parsed `cpuType` has no way to
query for the three subparts (name, pointer-width, and
subarch/endianness), nor any way to ask for just the first two parts.

For now, this commit simply fixes the problem in the two cases that
matter: `mips64el` and `powerpc64le`, which I believe are the only two
platforms supported by both rust and nixpkgs which have a
"subarchitecture".
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Aug 22, 2022
@lovesegfault lovesegfault merged commit fbd067f into NixOS:master Aug 25, 2022
@ghost ghost deleted the pr/rust/toTargetArch branch August 25, 2022 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant