2 files changed, 26 insertions(+), 5 deletions(-) gnu/packages/patches/mrustc-group-link.patch | 22 ++++++++++++++++++++++ gnu/packages/rust.scm | 9 ++++----- new file gnu/packages/patches/mrustc-group-link.patch @@ -0,0 +1,22 @@ +Surround the libraries with --start-group and --end-group to work +around . + +diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp +--- a/src/trans/codegen_c.cpp ++++ b/src/trans/codegen_c.cpp +@@ -960,6 +960,7 @@ namespace { + { + args.push_back("-L"); args.push_back(path); + } ++ args.push_back("-Wl,--start-group"); + for(const auto& lib : m_crate.m_ext_libs) { + ASSERT_BUG(Span(), lib.name != "", ""); + args.push_back("-l"); args.push_back(lib.name.c_str()); +@@ -975,6 +976,7 @@ namespace { + { + args.push_back("-l"); args.push_back(path.c_str()); + } ++ args.push_back("-Wl,--end-group"); + for( const auto& a : Target_GetCurSpec().m_backend_c.m_linker_opts ) + { + args.push_back( a.c_str() ); modified gnu/packages/rust.scm @@ -98,6 +98,7 @@ (url "https://github.com/thepowersgang/mrustc.git") (commit (string-append "v" version)))) (file-name (git-file-name name version)) + (patches (search-patches "mrustc-group-link.patch")) (sha256 (base32 "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2")))) @@ -128,10 +129,8 @@ (add-after 'patch-date 'unpack-target-compiler (lambda* (#:key inputs outputs #:allow-other-keys) (invoke "tar" "xf" (assoc-ref inputs "rustc")) - (chdir ,(string-append "rustc-" rustc-version "-src")) - (invoke "patch" "-p0" ,(string-append "../rustc-" rustc-version + (invoke "patch" "-p1" ,(string-append "rustc-" rustc-version "-src.patch")) - (chdir "..") (setenv "RUSTC_VERSION" ,rustc-version) (setenv "MRUSTC_TARGET_VER" ,(version-major+minor rustc-version)) @@ -274,7 +273,7 @@ safety and thread safety guarantees.") #t)) ;; This phase is overridden by newer versions. (replace 'configure - (lambda* (#:key inputs outputs #:allow-other-keys) + (lambda _ (setenv "CXX" "g++") (setenv "HOST_CXX" "g++") #t)) @@ -326,7 +325,7 @@ safety and thread safety guarantees.") (write name) (newline) (apply invoke - "output/rustc-build/rustc" + "output/rustc-build/rustc_binary" "-C" (string-append "linker=" (getenv "CC")) ;; Required for libterm. [back]