Skip to content
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

Zld 1.3.3 #164663

Merged
merged 2 commits into from
Mar 18, 2022
Merged

Zld 1.3.3 #164663

merged 2 commits into from
Mar 18, 2022

Conversation

rgnns
Copy link

@rgnns rgnns commented Mar 18, 2022

Motivation for this change

zld is a faster linker than Apple's linker.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@rgnns rgnns mentioned this pull request Mar 18, 2022
12 tasks
@happysalada
Copy link
Contributor

Thanks a lot!

@happysalada
Copy link
Contributor

@GrahamcOfBorg eval

1 similar comment
@happysalada
Copy link
Contributor

@GrahamcOfBorg eval

@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 Mar 18, 2022
@happysalada happysalada merged commit 4e630bb into NixOS:master Mar 18, 2022
@happysalada
Copy link
Contributor

I briefly tested this on arm and got some errors. absolutely no worries though.
also, there was an interesting article on linkers, rust and nixos recently.
https://matklad.github.io/2022/03/14/rpath-or-why-lld-doesnt-work-on-nixos.html
you might need to do stuff with the rpath as well, just putting it for your information.

@rgnns
Copy link
Author

rgnns commented Mar 19, 2022

@happysalada that's interesting. I tried using lld and it doesn't work while zld did (for a Cargo project). This was running from an M1 machine.

@happysalada
Copy link
Contributor

it looks like there are two things.
there is llvm.lld and there is llvm.bintools.lld
the bintools one has an additional wrapper around it (can be found in bintools-wrapper/ld-wrapper.sh
here is the issue tracking it #24744

it's incredibly confusing, but yeah, llvm.bintools.lld seems to be the right one.

@rgnns
Copy link
Author

rgnns commented Mar 19, 2022

What error did you get when running sod on arm?

@happysalada
Copy link
Contributor

I get exactly rpath problems.
So to be sure I've got
export RUSTFLAGS="-Clink-arg=-fuse-ld=${pkgs.zld}/bin/zld
then I get an error Library no loaded: @rpath/libLTO.dylib
Referenced from nix_zld_path/bin/zld
Reason tried nix_zld_path/bin/libLTO.dylib (no such file)

just replace nix_zld_path with the nix zld path.
So it's either missing something in the output derivation, or it's a matter of setting the rpath correctly.
Perhaps it needs a wrapper just like ld-wrapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants