gnu: rust-bootstrap: Add support for riscv64-linux.
* gnu/packages/rust.scm (%mrustc-source): Add patch. (rust-bootstrap)[native-inputs]: On riscv64-linux add gcc@9:lib. [supported-systems]: Add riscv64-linux. Adjust comment. * gnu/packages/patches/mrustc-riscv64-support.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it.
This commit is contained in:
parent
8af3a97b9e
commit
ca4bfb0f2d
3 changed files with 59 additions and 3 deletions
|
@ -1509,6 +1509,7 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/mono-mdoc-timestamping.patch \
|
%D%/packages/patches/mono-mdoc-timestamping.patch \
|
||||||
%D%/packages/patches/mosaicatcher-unbundle-htslib.patch \
|
%D%/packages/patches/mosaicatcher-unbundle-htslib.patch \
|
||||||
%D%/packages/patches/mrrescue-support-love-11.patch \
|
%D%/packages/patches/mrrescue-support-love-11.patch \
|
||||||
|
%D%/packages/patches/mrustc-riscv64-support.patch \
|
||||||
%D%/packages/patches/mtools-mformat-uninitialized.patch \
|
%D%/packages/patches/mtools-mformat-uninitialized.patch \
|
||||||
%D%/packages/patches/mumps-build-parallelism.patch \
|
%D%/packages/patches/mumps-build-parallelism.patch \
|
||||||
%D%/packages/patches/mumps-shared-libseq.patch \
|
%D%/packages/patches/mumps-shared-libseq.patch \
|
||||||
|
|
48
gnu/packages/patches/mrustc-riscv64-support.patch
Normal file
48
gnu/packages/patches/mrustc-riscv64-support.patch
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
Patch sent upstream for review:
|
||||||
|
https://github.com/thepowersgang/mrustc/pull/276
|
||||||
|
|
||||||
|
diff --git a/src/trans/target.cpp b/src/trans/target.cpp
|
||||||
|
index 420a2870..4d5eefb3 100644
|
||||||
|
--- a/src/trans/target.cpp
|
||||||
|
+++ b/src/trans/target.cpp
|
||||||
|
@@ -65,6 +65,13 @@ const TargetArch ARCH_POWERPC64LE = {
|
||||||
|
{ /*atomic(u8)=*/true, true, true, true, true },
|
||||||
|
TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8)
|
||||||
|
};
|
||||||
|
+// This is a guess
|
||||||
|
+const TargetArch ARCH_RISCV64 = {
|
||||||
|
+ "riscv64",
|
||||||
|
+ 64, false,
|
||||||
|
+ { /*atomic(u8)=*/true, true, true, true, true },
|
||||||
|
+ TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8)
|
||||||
|
+};
|
||||||
|
TargetSpec g_target;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -455,6 +462,13 @@ namespace
|
||||||
|
ARCH_POWERPC64LE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
+ else if(target_name == "riscv64-unknown-linux-gnu")
|
||||||
|
+ {
|
||||||
|
+ return TargetSpec {
|
||||||
|
+ "unix", "linux", "gnu", {CodegenMode::Gnu11, false, "riscv64-unknown-linux-gnu", BACKEND_C_OPTS_GNU},
|
||||||
|
+ ARCH_RISCV64
|
||||||
|
+ };
|
||||||
|
+ }
|
||||||
|
else if(target_name == "i586-pc-windows-gnu")
|
||||||
|
{
|
||||||
|
return TargetSpec {
|
||||||
|
diff --git a/tools/common/target_detect.h b/tools/common/target_detect.h
|
||||||
|
index a052da6b..42fea91a 100644
|
||||||
|
--- a/tools/common/target_detect.h
|
||||||
|
+++ b/tools/common/target_detect.h
|
||||||
|
@@ -34,6 +34,8 @@
|
||||||
|
# define DEFAULT_TARGET_NAME "powerpc64-unknown-linux-gnu"
|
||||||
|
# elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
|
||||||
|
# define DEFAULT_TARGET_NAME "powerpc64le-unknown-linux-gnu"
|
||||||
|
+# elif defined(__riscv) && __riscv_xlen == 64
|
||||||
|
+# define DEFAULT_TARGET_NAME "riscv64-unknown-linux-gnu"
|
||||||
|
# else
|
||||||
|
# warning "Unable to detect a suitable default target (linux-gnu)"
|
||||||
|
# endif
|
|
@ -137,7 +137,8 @@
|
||||||
(file-name (git-file-name name (git-version version revision commit)))
|
(file-name (git-file-name name (git-version version revision commit)))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0")))))
|
"0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0"))
|
||||||
|
(patches (search-patches "mrustc-riscv64-support.patch")))))
|
||||||
|
|
||||||
;;; Rust 1.54 is special in that it is built with mrustc, which shortens the
|
;;; Rust 1.54 is special in that it is built with mrustc, which shortens the
|
||||||
;;; bootstrap path.
|
;;; bootstrap path.
|
||||||
|
@ -172,6 +173,10 @@
|
||||||
;; https://github.com/thepowersgang/mrustc/issues/266
|
;; https://github.com/thepowersgang/mrustc/issues/266
|
||||||
;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105860
|
;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105860
|
||||||
("gcc" ,gcc-9)
|
("gcc" ,gcc-9)
|
||||||
|
;; TODO: STARTFILE_PREFIX_SPEC is fixed on gcc<10 on core-updates.
|
||||||
|
,@(if (target-riscv64?)
|
||||||
|
`(("gcc:lib" ,gcc-9 "lib"))
|
||||||
|
'())
|
||||||
("flex" ,flex)
|
("flex" ,flex)
|
||||||
("pkg-config" ,pkg-config)
|
("pkg-config" ,pkg-config)
|
||||||
;; Required for the libstd sources.
|
;; Required for the libstd sources.
|
||||||
|
@ -338,9 +343,11 @@
|
||||||
safety and thread safety guarantees.")
|
safety and thread safety guarantees.")
|
||||||
(home-page "https://github.com/thepowersgang/mrustc")
|
(home-page "https://github.com/thepowersgang/mrustc")
|
||||||
|
|
||||||
;; So far mrustc is (x86_64|aarch64)-only. It may support i686 soon:
|
;; The intermediate generated code is known to be inefficient and
|
||||||
|
;; therefore the build process needs 8GB of RAM while building.
|
||||||
|
;; It may support i686 soon:
|
||||||
;; <https://github.com/thepowersgang/mrustc/issues/78>.
|
;; <https://github.com/thepowersgang/mrustc/issues/78>.
|
||||||
(supported-systems '("x86_64-linux" "aarch64-linux"))
|
(supported-systems '("x86_64-linux" "aarch64-linux" "riscv64-linux"))
|
||||||
|
|
||||||
;; Dual licensed.
|
;; Dual licensed.
|
||||||
(license (list license:asl2.0 license:expat))))
|
(license (list license:asl2.0 license:expat))))
|
||||||
|
|
Reference in a new issue