Use system lld on NixOS instead of rust-lld (#30123)

The -Zgcc-ld=lld flag makes rust use the rust-lld
linker that is distributed as part of rust toolchain.
However, this flag doesn't work on nixos correctly
as
  1) rust-lld needs to be patched to have the correct rpath
     to find libz.so
  2) the bin/gcc-ld/ld.lld wrapper which calls rust-lld also
     needs to be patched to use the correct dynamic loader
  3) rust-lld doesn't respect NIX_LDFLAGS which contains
     the additional search path derived from buildInputs.
     The system linkers on nixos are wrapped so that
     NIX_LDFLAGS is added as the rpath to the final binary.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2023-08-18 11:48:05 +05:30 committed by GitHub
parent 218ad8f574
commit 1efecf9b50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 2 deletions

View file

@ -17,6 +17,7 @@ clangStdenv.mkDerivation rec {
gst_all_1.gst-plugins-bad
rustup
llvmPackages.bintools # provides lld
# Build utilities
cmake dbus gcc git pkg-config which llvm autoconf213 perl yasm m4