From: Conor Dooley <conor.dooley@microchip.com>
To: <linux-riscv@lists.infradead.org>
Cc: Miguel Ojeda <ojeda@kernel.org>, <conor@kernel.org>,
Conor Dooley <conor.dooley@microchip.com>
Subject: [RFC 1/2] scripts: generate_rust_target: enable building on RISC-V
Date: Fri, 24 Feb 2023 13:36:09 +0000 [thread overview]
Message-ID: <20230224133609.2877396-2-conor.dooley@microchip.com> (raw)
In-Reply-To: <20230224133609.2877396-1-conor.dooley@microchip.com>
From: Miguel Ojeda <ojeda@kernel.org>
Add the required bits from rust-for-linux to enable generating a RISC-V
target for rust.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
scripts/generate_rust_target.rs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 3c6cbe2b278d..72428fc66502 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -161,6 +161,25 @@ fn main() {
ts.push("features", features);
ts.push("llvm-target", "x86_64-linux-gnu");
ts.push("target-pointer-width", "64");
+ } else if cfg.has("RISCV") {
+ if cfg.has("64BIT") {
+ ts.push("arch", "riscv64");
+ ts.push("data-layout", "e-m:e-p:64:64-i64:64-i128:128-n64-S128");
+ ts.push("llvm-target", "riscv64-linux-gnu");
+ ts.push("target-pointer-width", "64");
+ } else {
+ ts.push("arch", "riscv32");
+ ts.push("data-layout", "e-m:e-p:32:32-i64:64-n32-S128");
+ ts.push("llvm-target", "riscv32-linux-gnu");
+ ts.push("target-pointer-width", "32");
+ }
+ ts.push("code-model", "medium");
+ ts.push("disable-redzone", true);
+ let mut features = "+m,+a".to_string();
+ if cfg.has("RISCV_ISA_C") {
+ features += ",+c";
+ }
+ ts.push("features", features);
} else {
panic!("Unsupported architecture");
}
--
2.39.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2023-02-24 13:37 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 13:36 [RFC 0/2] RISC-V: enable rust Conor Dooley
2023-02-24 13:36 ` Conor Dooley
2023-02-24 13:36 ` Conor Dooley [this message]
2023-02-24 13:36 ` [RFC 2/2] RISC-V: enable building the 64-bit kernels with rust support Conor Dooley
2023-02-24 13:39 ` Conor Dooley
2023-02-24 20:42 ` [RFC 0/2] RISC-V: enable rust Miguel Ojeda
2023-02-24 20:42 ` Miguel Ojeda
2023-02-24 21:00 ` Conor Dooley
2023-02-24 21:00 ` Conor Dooley
2023-02-24 22:20 ` Miguel Ojeda
2023-02-24 22:20 ` Miguel Ojeda
2023-02-24 22:32 ` Conor Dooley
2023-02-24 22:32 ` Conor Dooley
2023-02-25 8:20 ` Miguel Ojeda
2023-02-25 8:20 ` Miguel Ojeda
2023-02-24 21:31 ` Palmer Dabbelt
2023-02-24 21:31 ` Palmer Dabbelt
2023-02-24 22:38 ` Miguel Ojeda
2023-02-24 22:38 ` Miguel Ojeda
2023-02-24 23:18 ` Palmer Dabbelt
2023-02-24 23:18 ` Palmer Dabbelt
2023-02-25 8:37 ` Miguel Ojeda
2023-02-25 8:37 ` Miguel Ojeda
2023-03-06 19:18 ` Palmer Dabbelt
2023-03-06 19:18 ` Palmer Dabbelt
2023-03-06 19:26 ` Conor Dooley
2023-03-06 19:26 ` Conor Dooley
2023-03-06 19:28 ` Miguel Ojeda
2023-03-06 19:28 ` Miguel Ojeda
2023-03-07 2:20 ` Gary Guo
2023-03-07 2:20 ` Gary Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230224133609.2877396-2-conor.dooley@microchip.com \
--to=conor.dooley@microchip.com \
--cc=conor@kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=ojeda@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.