-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bfd, opcodes: Init separate derivations for binutils libraries #30484
Conversation
# providing the linker and related tools. The two we use now are GNU | ||
# Binutils, and Apple's "cctools"; "binutils" as an attempt to find an | ||
# unused middle-ground name that evokes both. | ||
bintools = binutils_bin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copumpkin I ended up going with "bintools" rather than "utils", for the reasons above, but the concept is the same as what I mentioned in #29396 (comment) .
@@ -1,4 +1,4 @@ | |||
{ stdenv, fetchurl, binutils }: | |||
{ stdenv, fetchurl, libbfd, binutilsOpcodes }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need libbfd here, oops
@@ -7796,6 +7800,10 @@ with pkgs; | |||
|
|||
belle-sip = callPackage ../development/libraries/belle-sip { }; | |||
|
|||
libbfd = callPackage ../development/libraries/libbfd { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bfd
? libbfd
? binutils-bfd
? Help me bikeshed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename binutils-opcodes
to libopcodes
for consistency with libbfd
? It seems to be known under this name, e.g. in http://mkfs.github.io/ and https://pypi.python.org/pypi/pybfd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good precedence finding!
pkgs/top-level/all-packages.nix
Outdated
@@ -7796,6 +7800,10 @@ with pkgs; | |||
|
|||
belle-sip = callPackage ../development/libraries/belle-sip { }; | |||
|
|||
libbfd = callPackage ../development/libraries/libbfd { }; | |||
|
|||
binutilsOpcodes = callPackage ../development/libraries/binutils-opcodes { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opcodes
? libopcodes
? binutils-opcodes
? Help me bikeshed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote binutils-opcodes
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, binutils-opcodes
. We don't do camelCase in package names anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't do camelCase in package names anymore.
Oh, glad I asked! I saw a vague trend but had no idea that was the policy. Kebob FTW!
@@ -0,0 +1,13 @@ | |||
--- a/opcodes/configure.ac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. this file can go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with the problem; why do we have those conditional outputs in binutils
in the first place?
pkgs/top-level/all-packages.nix
Outdated
@@ -7796,6 +7800,10 @@ with pkgs; | |||
|
|||
belle-sip = callPackage ../development/libraries/belle-sip { }; | |||
|
|||
libbfd = callPackage ../development/libraries/libbfd { }; | |||
|
|||
binutilsOpcodes = callPackage ../development/libraries/binutils-opcodes { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote binutils-opcodes
!
@abbradar Some of the Darwin ones might just be because nobody bothered to muck through the |
Good, 👍 then! Conditional outputs are not something nice to deal with. |
f068043
to
b3e68a9
Compare
In principle, building the libraries separately is nice, but: 1) The patch will probably make maintaining binutils significantly harder. 2) Applying the patch to binutils would cause a dependency on autoconf/automake during early stdenv bootstrap. 3) I don't really understand the motivation. What is the "combinatorial conditional soup"? |
Right now, binutils itself is built the same as before---stock, rebuilding those libs. This is also gross, but means stdenv avoids those issues. If I successfully upstream the patch or something like it, then we won't need to regenerate anything avoiding the dep. That would be a good time to make the binutils and gdb use these.
That's why I'm committing to maintain these new derivations and upstreaming the patch. If I suddenly go missing, well, one can revert and alias the new derivations to binutils. That's the best insurance I can offer :).
|
@Ericson2314 Thanks! Regarding
we would want to have binutils use the separate libraries, because otherwise we end up duplicating them. Which could lead to confusion if (say) both binutils and libbfd are in the build inputs. |
@edolstra Sure, I'll look into doing that as part of this then. Thanks! |
2ee0ab9
to
9594ac9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to ghc
make sense to me within the rationale of this patch.
af3ce14
to
88e960c
Compare
Ah, thanks. That's because the dev output is not the default for those antiquotations. Should be fixed now. @nixborg build |
@nixborg build |
Jobset created at https://hydra.mayflower.de/jobset/nixos/pr-30484 |
@nixborg build |
Jobset created at https://hydra.mayflower.de/jobset/nixos/pr-30484 |
I just added a commit to make myself a binutils maintainer too, since we'll eventually want binutils to use the libbfd and libopcodes derivations, which will require coordination with upstream just like merging the patch the build those separately in the first place. That doesn't change any hashes, so my old build still stands (I though the nixborg build would be a noop but staging changed in the interum). Merging, then. |
This has broken The test
i686 and x86_64 output is expected, but arm output is different and it fails the test:
/cc @vcunat |
Here is the object file produced by rust that the staging
It works with the master |
I'm going to apply this patch: https://sourceware.org/ml/binutils/2013-05/msg00271.html |
#30484 (comment) Since [1] libbfd is compiled with support for all available targets. However, it can not choose whether an ARM ELF file is elf32-littlearm, elf32-littlearm-symbian, or elf32-littlearm-vxworks, and fails with the "File format is ambiguous" error. Here [2] Alan Modra intended to prioritize the first of the three, but although his patch was merged and reportedly solved the issue, currently glibc 2.28.1 and 2.29.1 again fail to disambiguate these targets. This commit makes it prioritize elf32-littlearm over the other two. [1] f8741c3 [2] https://sourceware.org/ml/binutils/2013-05/msg00271.html
Actually that patch was merged and reportedly solved the issue. Glibc must have regressed since then. I've commited the following patch to staging: c76890f . It is worth fixing the issue upstream (I've confirmed that 2.29.1 is affected too) and my patch is not worth upstreaming as it is, but it is safe and it works. |
Reported upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=22458 |
pybfd also needs fixing on staging: #31818 |
PR NixOS#30484 (f8741c3) has split libbfd and libopcodes from binutils and gdb. The original pybfd setup.py is completely unsuitable to handle that. This commit replaces the original source with a fork with a patched setup.py.
@orivej This is extremely thorough troubleshooting and patching. Thank you so much! |
@Ericson2314 You are welcome! After this PR (not in |
My ultimate plan is single binutils always (we still pass |
Only pdf2djvu had correct logic that was overridden by the presence of |
Ah ok, I misunderstood. Good choice then. |
Motivation for this change
This is intended to be reviewed commit by commit.
On most distros, these are just built and distributed as part of binutils. We don't use binutils across the board, however, but rather switch between binutils and a cctools-binutils mashup, and change the
outputs on binutils too. This creates a combinatorial conditional soup which is hard to maintain.
My hope is to lower the the state space. While my patch isn't the most maintainable, they make downstream packages become more maintainable to compensate. The additional derivations themselves are completely platform-agnostic, always they always supports all possible target
platforms, and always yield "out" and "dev" outputs. That, in turn, allows downstream packages to not worry about a dependency shape-shifting under them.
In fact, the actual binutils package can avoid needing multiple outputs now that these serve the requisite libraries, so that also can become simpler on all platforms, too, removing the original wart this PR circumnavigates for now. Actually changing the binutils package to leverage is a mass rebuild, however, so I'll leave that for a separate PR.
I do hope to upstream something like my patch too, but until then I'll make myself maintainer of these derivations.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)CC @bgamari @orivej