rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
To: linux-arm-kernel@lists.infradead.org, rust-for-linux@vger.kernel.org
Cc: Miguel Ojeda <ojeda@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	steve.capper@arm.com
Subject: [PATCH 1/3] arm64: rust: Enable Rust support for AArch64
Date: Wed, 25 Jan 2023 16:37:37 +0000	[thread overview]
Message-ID: <20230125163739.3798252-2-Jamie.Cunliffe@arm.com> (raw)
In-Reply-To: <20230125163739.3798252-1-Jamie.Cunliffe@arm.com>

From: Miguel Ojeda <ojeda@kernel.org>

This commit provides the build flags for Rust for AArch64. The core Rust
support already in the kernel does the rest.

The Rust samples have been tested with this commit.

[jcunliffe: Arm specific parts taken from Miguel's upstream tree]

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Co-developed-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
Signed-off-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
---
 Documentation/rust/arch-support.rst |  1 +
 arch/arm64/Kconfig                  |  1 +
 scripts/generate_rust_target.rs     | 13 ++++++++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
index 6982b63775da..3776059a385a 100644
--- a/Documentation/rust/arch-support.rst
+++ b/Documentation/rust/arch-support.rst
@@ -15,5 +15,6 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file.
 ============  ================  ==============================================
 Architecture  Level of support  Constraints
 ============  ================  ==============================================
+``arm64``     Maintained        None.
 ``x86``       Maintained        ``x86_64`` only.
 ============  ================  ==============================================
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 03934808b2ed..fc3800e82802 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -209,6 +209,7 @@ config ARM64
 	select HAVE_FUNCTION_ARG_ACCESS_API
 	select MMU_GATHER_RCU_TABLE_FREE
 	select HAVE_RSEQ
+	select HAVE_RUST
 	select HAVE_STACKPROTECTOR
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_KPROBES
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 3c6cbe2b278d..fe0e4ba54492 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -148,7 +148,18 @@ fn main() {
     let mut ts = TargetSpec::new();
 
     // `llvm-target`s are taken from `scripts/Makefile.clang`.
-    if cfg.has("X86_64") {
+    if cfg.has("ARM64") {
+        ts.push("arch", "aarch64");
+        ts.push(
+            "data-layout",
+            "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
+        );
+        ts.push("disable-redzone", true);
+        ts.push("features", "+strict-align,+neon,+fp-armv8");
+        ts.push("llvm-target", "aarch64-linux-gnu");
+        ts.push("max-atomic-width", 128);
+        ts.push("target-pointer-width", "64");
+    } else if cfg.has("X86_64") {
         ts.push("arch", "x86_64");
         ts.push(
             "data-layout",
-- 
2.30.2


  reply	other threads:[~2023-01-25 16:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 16:37 [PATCH 0/3] Rust enablement for AArch64 Jamie Cunliffe
2023-01-25 16:37 ` Jamie Cunliffe [this message]
2023-01-25 19:50   ` [PATCH 1/3] arm64: rust: Enable Rust support " Vincenzo Palazzo
2023-01-25 19:56   ` Vincenzo Palazzo
2023-01-26 16:35   ` Will Deacon
2023-01-26 17:56     ` Miguel Ojeda
2023-01-31 16:19       ` Will Deacon
2023-01-31 16:49         ` Björn Roy Baron
2023-01-31 18:55         ` Miguel Ojeda
2023-04-18 15:06           ` Jamie Cunliffe
2023-01-27 14:09   ` Gary Guo
2023-05-02 13:41   ` Asahi Lina
2023-01-25 16:37 ` [PATCH 2/3] arm64: rust: Enable PAC support for Rust Jamie Cunliffe
2023-01-25 19:54   ` Vincenzo Palazzo
2023-01-25 16:37 ` [PATCH 3/3] arm64: rust: Disable neon and fp target features Jamie Cunliffe
2023-01-25 17:49   ` Miguel Ojeda
2023-01-25 19:55   ` Vincenzo Palazzo
2023-01-26 16:37   ` Will Deacon
2023-01-25 18:01 ` [PATCH 0/3] Rust enablement for AArch64 Miguel Ojeda
2023-03-07  9:32 ` Asahi Lina
2023-03-07 12:17   ` Miguel Ojeda

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=20230125163739.3798252-2-Jamie.Cunliffe@arm.com \
    --to=jamie.cunliffe@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=steve.capper@arm.com \
    --cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).