[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Fwd: GNU tools netbsd vs netbsdelf
from John Ericson:
t, allow me to give some general background about why we care about this; feel free to skip this paragraph if uninterested. We Nixpkgs/NixOS developers aim to support cross compilation to as many notable platforms as possible.
Recently, that's involved polishing our support for NetBSD. You can see some of the code here [nixpkgs-netbsd] if you like. Because we support so many platforms, it is very important we remove special cases / keep overall
complexity in check. Issues like this that might seem bit obsessive-compulsive really are important to us, but these special cases do add up if left alone.
The issue we've encountered is that GNU tools don't seem to support dynamic linking properly for cross compilation when the "OS" part of the config is "netbsd"; they seems to require "netbsdelf" instead. Likewise, I've found some
traces of "netbsdaout" being in usage in GNU config's config.guess [gnu-config-netbsdaout]. It would appear that there that "netbsd" means "netbsdaout" by default, and only "netbsdelf" enables proper ELF support.
The problem for us is that including the linked binary format with the OS like this breaks our usual tooling; we added a [hack], but it is still deficient as it breaks parsing-rendering round trips.
My first suggestion is that these GNU tools should support <CPU>-netbsd-elf and <CPU>-netbsd-aout as alternative ways of disambiguating. Putting it in an additional "abi" component of the config (this is the 4th component with a
vendor (including "pc" or "unknown" in the second position) is something we already support for e.g. bare metal programing that nonetheless use ELF (as supported by the bootloader or whatever). This has the advantage of being a
My second suggestion would just be to change the meaning of the ambiguous plain "netbsd" to mean ELF rather than a.out by default. NetBSD has, of course, supported ELF for many years now, and other OSes that switched to ELF have
made the same change long ago, so this would be hopefully be only a tiny breakage, and one with precedent. See also this comment in GNU config that even anticipates this change [gnu-config-comment].
If you find either of those changes acceptable, I would be happy to do all the work writing and submitting patches upstream to GCC, Binutils, etc. I have spent much time overhauling GNU config to systematize the parsing of these,
so there is precedent for upstream putting up with these sorts of cleanups. I wanted to ask here first before doing anything, as I wouldn't want to change upstream stuff for NetBSD behind your backs.
Are you trying to cross-compile from Linux (Nix) to NetBSD, or from NetBSD to Linux?
It looks like Linux/Nix to NetBSD.
Is it possible to cross-compile/bootstrap NixOS from NetBSD?
Main Index |
Thread Index |