From 30b2f19fc1edabbcf929d400f289220875440ffe Mon Sep 17 00:00:00 2001
From: Pierre Langlois <pierre.langlois@gmx.com>
Date: Tue, 1 Sep 2020 00:46:47 +0100
Subject: [PATCH 1/2] mrustc: Use lld.
---
gnu/packages/patches/mrustc-use-lld.patch | 12 ++++++++++++
gnu/packages/rust.scm | 9 +++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/mrustc-use-lld.patch
new file mode 100644
@@ -0,0 +1,12 @@
+diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp
+index df0abf6f..7ab8d183 100644
+--- a/src/trans/codegen_c.cpp
++++ b/src/trans/codegen_c.cpp
+@@ -953,6 +953,7 @@ namespace {
+ break;
+ }
+ args.push_back(m_outfile_path_c.c_str());
++ args.push_back("-fuse-ld=lld");
+ switch(out_ty)
+ {
+ case CodegenOutput::DynamicLibrary:
@@ -128,14 +128,17 @@
(file-name (git-file-name name version))
(sha256
(base32
- "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2"))))
+ "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2"))
+ (patches (search-patches "mrustc-use-lld.patch"))))
(outputs '("out" "cargo"))
(build-system gnu-build-system)
(inputs
- `(("zlib" ,zlib)))
+ `(("lld" ,lld)
+ ("zlib" ,zlib)))
(native-inputs
`(("bison" ,bison)
("flex" ,flex)
+ ("gcc" ,gcc-10)
;; Required for the libstd sources.
("rustc" ,(package-source rust-1.29))))
(arguments
@@ -418,6 +421,8 @@ safety and thread safety guarantees.")
("cmake" ,cmake-minimal)
("flex" ,flex) ; For the tests
("gdb" ,gdb) ; For the tests
+ ("gcc" ,gcc-10)
+ ("lld" ,lld)
("procps" ,procps) ; For the tests
("python-2" ,python-2)
("rustc-bootstrap" ,mrustc)
--
2.28.0