From: WANG Rui <wangrui@loongson.cn>
To: Miguel Ojeda <ojeda@kernel.org>,
Alex Gaynor <alex.gaynor@gmail.com>,
Wedson Almeida Filho <wedsonaf@gmail.com>,
Huacai Chen <chenhuacai@kernel.org>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Jamie Cunliffe" <Jamie.Cunliffe@arm.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"WANG Xuerui" <kernel@xen0n.name>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
loongarch@lists.linux.dev, loongson-kernel@lists.loongnix.cn,
"WANG Rui" <wangrui@loongson.cn>
Subject: [PATCH] loongarch: rust: Switch to use built-in rustc target
Date: Mon, 4 Mar 2024 22:14:26 +0800 [thread overview]
Message-ID: <20240304141426.163517-1-wangrui@loongson.cn> (raw)
This commit switches to using the built-in rustc
loongarch64-unknown-none-softfloat target for LoongArch.
The Rust samples have been tested with this commit.
Signed-off-by: WANG Rui <wangrui@loongson.cn>
---
base-commit: ("rust: Refactor the build target to allow the use of builtin targets")
Link: https://lore.kernel.org/r/20231020155056.3495121-2-Jamie.Cunliffe@arm.com
---
arch/loongarch/Makefile | 2 +-
rust/Makefile | 2 +-
scripts/Makefile | 2 +-
scripts/generate_rust_target.rs | 7 +------
4 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index df6caf79537a..17aabe7b0315 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -101,7 +101,7 @@ ifdef CONFIG_OBJTOOL
KBUILD_CFLAGS += -fno-jump-tables
endif
-KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
+KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat
KBUILD_RUSTFLAGS_MODULE += -Crelocation-model=pic
ifeq ($(CONFIG_RELOCATABLE),y)
diff --git a/rust/Makefile b/rust/Makefile
index fe045dbc701e..cb40a1ce1331 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -437,7 +437,7 @@ $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--re
$(obj)/core.o: private rustc_target_flags = $(core-cfgs)
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
$(call if_changed_dep,rustc_library)
-ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),)
+ifdef CONFIG_X86_64
$(obj)/core.o: scripts/target.json
endif
diff --git a/scripts/Makefile b/scripts/Makefile
index bc90520a5426..fe56eeef09dd 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -12,7 +12,7 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_builder
hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_gen
-ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),)
+ifdef CONFIG_X86_64
always-$(CONFIG_RUST) += target.json
filechk_rust_target = $< < include/config/auto.conf
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 54919cf48621..acd3b1acef83 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -164,12 +164,7 @@ fn main() {
ts.push("llvm-target", "x86_64-linux-gnu");
ts.push("target-pointer-width", "64");
} else if cfg.has("LOONGARCH") {
- ts.push("arch", "loongarch64");
- ts.push("data-layout", "e-m:e-p:64:64-i64:64-i128:128-n64-S128");
- ts.push("features", "-f,-d");
- ts.push("llvm-target", "loongarch64-linux-gnusf");
- ts.push("llvm-abiname", "lp64s");
- ts.push("target-pointer-width", "64");
+ panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target");
} else {
panic!("Unsupported architecture");
}
--
2.44.0
next reply other threads:[~2024-03-04 14:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 14:14 WANG Rui [this message]
2024-03-04 16:07 ` [PATCH] loongarch: rust: Switch to use built-in rustc target Miguel Ojeda
2024-03-05 7:08 ` WANG Rui
2024-03-05 9:58 ` Huacai Chen
2024-03-05 10:10 ` Miguel Ojeda
2024-03-05 10:23 ` Huacai Chen
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=20240304141426.163517-1-wangrui@loongson.cn \
--to=wangrui@loongson.cn \
--cc=Jamie.Cunliffe@arm.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=gary@garyguo.net \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=loongson-kernel@lists.loongnix.cn \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=wedsonaf@gmail.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).