Skip to content

Commit 4281c2c

Browse files
committed
patch rust-lld and ld.lld on NixOS
1 parent 3186d17 commit 4281c2c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bootstrap/bootstrap.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,9 @@ def download_toolchain(self):
617617
self.fix_bin_or_dylib("{}/bin/rustdoc".format(bin_root))
618618
self.fix_bin_or_dylib("{}/libexec/rust-analyzer-proc-macro-srv".format(bin_root))
619619
lib_dir = "{}/lib".format(bin_root)
620+
rustlib_bin_dir = "{}/rustlib/{}/bin".format(lib_dir, self.build)
621+
self.fix_bin_or_dylib("{}/rust-lld".format(rustlib_bin_dir))
622+
self.fix_bin_or_dylib("{}/gcc-ld/ld.lld".format(rustlib_bin_dir))
620623
for lib in os.listdir(lib_dir):
621624
# .so is not necessarily the suffix, there can be version numbers afterwards.
622625
if ".so" in lib:
@@ -731,12 +734,9 @@ def fix_bin_or_dylib(self, fname):
731734

732735
patchelf = "{}/bin/patchelf".format(nix_deps_dir)
733736
rpath_entries = [
734-
# Relative default, all binary and dynamic libraries we ship
735-
# appear to have this (even when `../lib` is redundant).
736-
"$ORIGIN/../lib",
737737
os.path.join(os.path.realpath(nix_deps_dir), "lib")
738738
]
739-
patchelf_args = ["--set-rpath", ":".join(rpath_entries)]
739+
patchelf_args = ["--add-rpath", ":".join(rpath_entries)]
740740
if ".so" not in fname:
741741
# Finally, set the correct .interp for binaries
742742
with open("{}/nix-support/dynamic-linker".format(nix_deps_dir)) as dynamic_linker:

0 commit comments

Comments
 (0)