summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch
blob: 0a52fe60e9dcd68fe9140c441894689e1c3d6e29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
index 77ac03d66..d12f77592 100644
--- a/mesonbuild/scripts/depfixer.py
+++ b/mesonbuild/scripts/depfixer.py
@@ -337,6 +337,15 @@ class Elf(DataSizes):
         if not new_rpath:
             self.remove_rpath_entry(entrynum)
         else:
+            # Clear old rpath to avoid stale references,
+            # not heeding the warning above about de-duplication
+            # since it does not seem to cause issues for us
+            # and not doing so trips up Nix’s reference checker.
+            # See https://github.com/NixOS/nixpkgs/pull/46020
+            # and https://github.com/NixOS/nixpkgs/issues/95163
+            self.bf.seek(rp_off)
+            self.bf.write(b'\0'*len(old_rpath))
+
             self.bf.seek(rp_off)
             self.bf.write(new_rpath)
             self.bf.write(b'\0')