lib.systems: Internally translate -gnuabielfv<1,2> to -gnu + gcc.abi#493090
Draft
OPNA2608 wants to merge 5 commits intoNixOS:stagingfrom
Draft
lib.systems: Internally translate -gnuabielfv<1,2> to -gnu + gcc.abi#493090OPNA2608 wants to merge 5 commits intoNixOS:stagingfrom
OPNA2608 wants to merge 5 commits intoNixOS:stagingfrom
Conversation
…ality We switched to gnuabielfv1 being the default.
While GCC supports the powerpc64-unknown-linux-gnuabielfv1 & powerpc64-unknown-linux-gnuabielfv2 triplets, Clang does not. So using these triplets while configuring compilers and other tools that build upon them leads to issues and hacks. Instead, set the name that should be used for -gnuabielfv<1,2> to just -gnu, with an annotation of the actual ABI for GCC / the cc-wrapper. This still allows isAbiElfv<1,2> inspections to work without resulting in triplets that are unknown to Clang & rustc.
This reverts commit 8b06bf8.
…Clang" This reverts commit 07bce58.
Contributor
Author
let
pkgs = import ./. { };
triplets = [
"powerpc64-linux"
"powerpc64-unknown-linux-gnuabielfv1"
"powerpc64-unknown-linux-gnuabielfv2"
"powerpc64-unknown-linux-musl"
];
examples = [
"ppc64-elfv1"
"ppc64-elfv2"
];
inheritDetails = platform: {
inherit (platform) config isAbiElfv1 isAbiElfv2;
parsed-abi = builtins.removeAttrs platform.parsed.abi [ "assertions" ];
gcc-abi = platform.gcc.abi or null;
};
in
(builtins.map (triplet:
let
crossPkgs = import ./. { crossSystem = triplet; };
in
(inheritDetails crossPkgs.stdenv.hostPlatform) // {
via = "triplet-${triplet}";
}
) triplets)
++ (builtins.map (example:
let
crossPkgs = pkgs.pkgsCross.${example};
in
(inheritDetails crossPkgs.stdenv.hostPlatform) // {
via = "example-${example}";
}
) examples)[
{
config = "powerpc64-unknown-linux-gnu";
gcc-abi = "elfv1";
isAbiElfv1 = true;
isAbiElfv2 = false;
parsed-abi = {
_type = "abi";
abi = "elfv1";
name = "gnu";
};
via = "triplet-powerpc64-linux";
}
{
config = "powerpc64-unknown-linux-gnu";
gcc-abi = "elfv1";
isAbiElfv1 = true;
isAbiElfv2 = false;
parsed-abi = {
_type = "abi";
abi = "elfv1";
name = "gnu";
};
via = "triplet-powerpc64-unknown-linux-gnuabielfv1";
}
{
config = "powerpc64-unknown-linux-gnu";
gcc-abi = "elfv2";
isAbiElfv1 = false;
isAbiElfv2 = true;
parsed-abi = {
_type = "abi";
abi = "elfv2";
name = "gnu";
};
via = "triplet-powerpc64-unknown-linux-gnuabielfv2";
}
{
config = "powerpc64-unknown-linux-musl";
gcc-abi = "elfv2";
isAbiElfv1 = false;
isAbiElfv2 = true;
parsed-abi = {
_type = "abi";
name = "musl";
};
via = "triplet-powerpc64-unknown-linux-musl";
}
{
config = "powerpc64-unknown-linux-gnu";
gcc-abi = "elfv1";
isAbiElfv1 = true;
isAbiElfv2 = false;
parsed-abi = {
_type = "abi";
abi = "elfv1";
name = "gnu";
};
via = "example-ppc64-elfv1";
}
{
config = "powerpc64-unknown-linux-gnu";
gcc-abi = "elfv2";
isAbiElfv1 = false;
isAbiElfv2 = true;
parsed-abi = {
_type = "abi";
abi = "elfv2";
name = "gnu";
};
via = "example-ppc64-elfv2";
}
] |
Member
|
@Ericson2314 I remember discussing with you how we should handle mismatching triples between compilers with you years ago. What do you think is right here? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While GCC supports the powerpc64-unknown-linux-gnuabielfv1 & powerpc64-unknown-linux-gnuabielfv2 triplets, Clang does not.
So using these triplets while configuring compilers and other tools that build upon them leads to issues and hacks.
Instead, set the name that should be used for -gnuabielfv<1,2> to just -gnu, with an annotation of the actual ABI for
GCC / the cc-wrapper. This still allows isAbiElfv<1,2> inspections to work without resulting in triplets that are
unknown to Clang & rustc.
I don't know if this is a good idea, I feel like it kinda just replaces hacks in one location with hacks in another… But it fixes some things ig… I don't feel like merging this as-is is fine without someone with a better understanding of & opinion on the
lib.systemsstuff having a look. Turning to draft once pings go out.powerpc64-unknown-linux-gnutriplet is still rejected bylib.systems.parse.abis.gnu.assertions- we want the user to be precise about which ABI they want. Maybe abit confusing cus the used triplet will be shown aspowerpc64-unknown-linux-gnu, but passing that in will trigger an assertion failure.lib/systems/examples.nixis because while passing those triplets as a string incrossSystemgets them parsed as expected, usingpkgsCross.ppc64-elfv<1,2>just used the triplet as-is without any parsing of the components. Which lead to neither of theisAbiElfv<1,2>inspections working, amongst other issues.fileof cross results reports the expected ABI version.pkgsCross.ppc64-elfv<1,2>.capnproto, and anything else cross that usesclangStdenv.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.