about summary refs log tree commit diff
path: root/pkgs/development/tools/mold
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2023-07-13 22:28:27 -0500
committerAustin Seipp <aseipp@pobox.com>2023-07-14 05:46:34 -0500
commite4db1840dcf3c73085ad72a4ef13fbbe788f5a20 (patch)
tree1b8faa922a13de75de3204b31bd27527efe15714 /pkgs/development/tools/mold
parentbb5355eb447af239d1259462cb1004a40362e4a5 (diff)
mold: patch an upstream bug in --strip-debug
Mold currently has a bug where `--strip-debug` is treated the same as
`--strip-all`; this causes things like Rust backtraces to stop working
because the symbol tables get stripped.

The fix is trivial and obvious, and comes from an upstream patch that
needs to be merged and release.

GitHub Issue: rui314/mold#1038
Signed-off-by: Austin Seipp <aseipp@pobox.com>
Diffstat (limited to 'pkgs/development/tools/mold')
-rw-r--r--pkgs/development/tools/mold/default.nix4
-rw-r--r--pkgs/development/tools/mold/fix-debug-strip.patch23
2 files changed, 27 insertions, 0 deletions
diff --git a/pkgs/development/tools/mold/default.nix b/pkgs/development/tools/mold/default.nix
index 04ed7db711476..ac60a01a1ae99 100644
--- a/pkgs/development/tools/mold/default.nix
+++ b/pkgs/development/tools/mold/default.nix
@@ -33,6 +33,10 @@ stdenv.mkDerivation rec {
     mimalloc
   ];
 
+  patches = [
+    ./fix-debug-strip.patch # fix --debug-strip; https://github.com/rui314/mold/pull/1038
+  ];
+
   postPatch = ''
     sed -i CMakeLists.txt -e '/.*set(DEST\ .*/d'
   '';
diff --git a/pkgs/development/tools/mold/fix-debug-strip.patch b/pkgs/development/tools/mold/fix-debug-strip.patch
new file mode 100644
index 0000000000000..78906efc73ac4
--- /dev/null
+++ b/pkgs/development/tools/mold/fix-debug-strip.patch
@@ -0,0 +1,23 @@
+From b699b73451c57ac01c2680c0b86e1f56ca19e51c Mon Sep 17 00:00:00 2001
+From: Jakub Konka <kubkon@jakubkonka.com>
+Date: Sat, 6 May 2023 07:55:46 +0200
+Subject: [PATCH] Fix handling of --debug-strip
+
+Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
+---
+ elf/cmdline.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/elf/cmdline.cc b/elf/cmdline.cc
+index 3ac19f237..731af63ab 100644
+--- a/elf/cmdline.cc
++++ b/elf/cmdline.cc
+@@ -994,7 +994,7 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) {
+     } else if (read_flag("strip-all") || read_flag("s")) {
+       ctx.arg.strip_all = true;
+     } else if (read_flag("strip-debug") || read_flag("S")) {
+-      ctx.arg.strip_all = true;
++      ctx.arg.strip_debug = true;
+     } else if (read_flag("warn-unresolved-symbols")) {
+       ctx.arg.unresolved_symbols = UNRESOLVED_WARN;
+     } else if (read_flag("error-unresolved-symbols")) {