Conversation
|
Nice, I really liked the idea of being able to build for either ABI. The only reason I removed that functionality is that gnu-config seemed to be breaking when passed the nonstandard suffixes, but this doesn't seem to be a problem anymore, so I'm +1 on trying it out again. |
|
|
Can you rebase so the fixups are squashed? I think then this is good to go. |
9ca89fd to
4e87794
Compare
|
@Mindavi: done! |
4e87794 to
b2e0e09
Compare
|
@ofborg build pkgsCross.ppc64.zlib pkgsCross.ppc64-musl.zlib pkgsCross.ppc64.bash Not sure if this will be done before the 1h time, but let's see. |
|
This seems to have broken |
| isStatic = true; | ||
| parsed = makeMuslParsedPlatform stdenv.hostPlatform.parsed; | ||
| } // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { | ||
| gcc.abi = "elfv2"; |
Commit 82ff1f5 in #182807 removed two lines from stage.nix which were responsible for making sure the `gcc` for `pkgsStatic` on powerpc64 was built with the `--with-abi=elfv2` flag. Unfortunately this causes build failures for `pkgsCross.ppc64.pkgsStatic`, as reported here: #182807 (comment) This commit reverts the deletion. Unfortunately ugly kludges like this are necessary because nixpkgs' `lib/systems/` doesn't understand the difference between a libc and an abi. So we have no clean way to tell nixpkgs "musl on big-endian powerpc64 always uses the ELFv2 ABI" -- it thinks that musl is an ABI. Until that gets fixed there is no better way to add the flag.
|
Possibly of interest, Linux 6.2 supposedly lets you build big endian kernels (not just userspace) with |
| # Default ppc64 BE to ELFv2 | ||
| else if isPower64 parsed && isBigEndian parsed then abis.gnuabielfv2 |
There was a problem hiding this comment.
Were these two lines really essential?
They cause a problem: now if we parse powerpc64-apple-linux-gnu and then unparse it, we get back powerpc64-apple-linux-gnuabielfv2. That disagrees with gnu-config:
$ /nix/store/rvxxihfvp9z7h4lw6w60lv7mvsn97dwn-gnu-config-2023-01-21/config.sub powerpc64-apple-linux-gnu
powerpc64-apple-linux-gnu
I still agree with nixpkgs PowerPC64-BE using elfv2, I just don't think the triple parsing routine is the right place to impose that default...
I've included a commit to revert these two lines as part of #235230; if that's a problem, or if there's a different way we should be handling this, please let me know.
There was a problem hiding this comment.
428c5456060ebe25ac889d9f666dfd3d114cbff0
Description of changes
Little context:
Today the PowerPC ISA has access to several ABIs, notably ELFv1 and ELFv2. If I got the history right, the ELFv1 architecture and PowerPC big-endian came first. Then, ELFv2 was created for PowerPC little-endian, but intentionally in a way that is compatible with PowerPC big-endian.1
In this situation, GCC made the sensible choice of defaulting to ELFv1 for big-endian, and ELFv2 for little-endian in order not to break ABI compatibility with existing compiled code.
Today ELFv1 is less and less used, and some distributions (Gentoo, Void Linux, FreeBSD) are using PowerPC64 big-endian with the ELFv2 ABI by default. I've understood that in NixOS we would want ELFv2 as a default.
However, some packages wrongfully make the assumption that PowerPC64 big-endian implies ELFv1. On the other hand, some packages just don't work with ELFv1, for example the whole musl libc.
---
The
-elfv1and-elfv2system suffixes were added in #111345, but removed in #116495. This PR adds them back, asgnuabielfv1,gnuabielfv2, andmuslabielfv2.This PR also makes gnuabielfv2 the default for PowerPC64 big endian, which users may find less confusing, if they try
crossSystem.system = "powerpc64-linux";instead ofcrossSystem = lib.systems.examples.ppc64;.The GNU ELFv1 ABI is available again, although unless someone is
dlopening something outside of Nix, I don't think there are may usecases.It also adds a convenience
isPower64BeElfv2function, since a few downstream packages needs patches for this specific case.Note that LLVM is still an issue.
Pinging @r-burns as the author of both aforementioned PRs.
Things done
sandbox = trueset innix.conf? (See Nix manual)gccattribute of pkgs/test's cross tests./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notesAlso managed to compile a NixOS image with some other patches that I'll be upstreaming.