* [PATCH] loongarch: rust: Switch to use built-in rustc target
@ 2024-03-04 14:14 WANG Rui
2024-03-04 16:07 ` Miguel Ojeda
0 siblings, 1 reply; 6+ messages in thread
From: WANG Rui @ 2024-03-04 14:14 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Huacai Chen
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Jamie Cunliffe, Catalin Marinas,
WANG Xuerui, rust-for-linux, linux-kernel, loongarch,
loongson-kernel, WANG Rui
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] loongarch: rust: Switch to use built-in rustc target
2024-03-04 14:14 [PATCH] loongarch: rust: Switch to use built-in rustc target WANG Rui
@ 2024-03-04 16:07 ` Miguel Ojeda
2024-03-05 7:08 ` WANG Rui
2024-03-05 9:58 ` Huacai Chen
0 siblings, 2 replies; 6+ messages in thread
From: Miguel Ojeda @ 2024-03-04 16:07 UTC (permalink / raw)
To: WANG Rui
Cc: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Huacai Chen,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Jamie Cunliffe, Catalin Marinas,
WANG Xuerui, rust-for-linux, linux-kernel, loongarch,
loongson-kernel
On Mon, Mar 4, 2024 at 3:14 PM WANG Rui <wangrui@loongson.cn> wrote:
>
> 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")
I couldn't apply it on top of commit f82811e22b48 in arm64's tree
(which is the base? -- the offset differs significantly in the arch
Makefile), but I nevertheless applied it manually on top of that one,
build-tested it for loongarch64 and boot-tested it for x86_64:
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Tested-by: Miguel Ojeda <ojeda@kernel.org>
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] loongarch: rust: Switch to use built-in rustc target
2024-03-04 16:07 ` Miguel Ojeda
@ 2024-03-05 7:08 ` WANG Rui
2024-03-05 9:58 ` Huacai Chen
1 sibling, 0 replies; 6+ messages in thread
From: WANG Rui @ 2024-03-05 7:08 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Huacai Chen,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Jamie Cunliffe, Catalin Marinas,
WANG Xuerui, rust-for-linux, linux-kernel, loongarch,
loongson-kernel
On Tue, Mar 5, 2024 at 12:09 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Mon, Mar 4, 2024 at 3:14 PM WANG Rui <wangrui@loongson.cn> wrote:
> >
> > 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")
>
> I couldn't apply it on top of commit f82811e22b48 in arm64's tree
> (which is the base? -- the offset differs significantly in the arch
> Makefile), but I nevertheless applied it manually on top of that one,
> build-tested it for loongarch64 and boot-tested it for x86_64:
>
> Acked-by: Miguel Ojeda <ojeda@kernel.org>
> Tested-by: Miguel Ojeda <ojeda@kernel.org>
Oops. The actual base is tag next-20240228. I just want to make it
clear that this patch needs to be based on ("rust: Refactor the build
target to allow the use of builtin targets").
Thanks!
Regards,
Rui
>
> Thanks!
>
> Cheers,
> Miguel
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] loongarch: rust: Switch to use built-in rustc target
2024-03-04 16:07 ` Miguel Ojeda
2024-03-05 7:08 ` WANG Rui
@ 2024-03-05 9:58 ` Huacai Chen
2024-03-05 10:10 ` Miguel Ojeda
1 sibling, 1 reply; 6+ messages in thread
From: Huacai Chen @ 2024-03-05 9:58 UTC (permalink / raw)
To: Miguel Ojeda
Cc: WANG Rui, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Jamie Cunliffe, Catalin Marinas,
WANG Xuerui, rust-for-linux, linux-kernel, loongarch,
loongson-kernel
Hi, Miguel,
On Tue, Mar 5, 2024 at 12:07 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Mon, Mar 4, 2024 at 3:14 PM WANG Rui <wangrui@loongson.cn> wrote:
> >
> > 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")
>
> I couldn't apply it on top of commit f82811e22b48 in arm64's tree
> (which is the base? -- the offset differs significantly in the arch
> Makefile), but I nevertheless applied it manually on top of that one,
> build-tested it for loongarch64 and boot-tested it for x86_64:
>
> Acked-by: Miguel Ojeda <ojeda@kernel.org>
> Tested-by: Miguel Ojeda <ojeda@kernel.org>
The base of the loongarch tree doesn't contain the arm64 modifications
now, so this patch is better to be applied on the rust tree with my
Acked-by. But if you have some trouble doing that, I can also manually
merge the arm64 parts to the loongarch tree, and then apply this
patch. Thanks.
Huacai
>
> Thanks!
>
> Cheers,
> Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] loongarch: rust: Switch to use built-in rustc target
2024-03-05 9:58 ` Huacai Chen
@ 2024-03-05 10:10 ` Miguel Ojeda
2024-03-05 10:23 ` Huacai Chen
0 siblings, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2024-03-05 10:10 UTC (permalink / raw)
To: Huacai Chen
Cc: WANG Rui, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Jamie Cunliffe, Catalin Marinas,
WANG Xuerui, rust-for-linux, linux-kernel, loongarch,
loongson-kernel
On Tue, Mar 5, 2024 at 10:58 AM Huacai Chen <chenhuacai@kernel.org> wrote:
>
> The base of the loongarch tree doesn't contain the arm64 modifications
> now, so this patch is better to be applied on the rust tree with my
> Acked-by. But if you have some trouble doing that, I can also manually
> merge the arm64 parts to the loongarch tree, and then apply this
> patch. Thanks.
The rust tree doesn't have the arm64 changes either (i.e. they are in
the arm64 tree), so we would have the same issue.
Since it is quite late and there is no rush for this, I would suggest
applying it after the merge window in loongarch64 and thus avoiding a
merge. But, of course, up to you!
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] loongarch: rust: Switch to use built-in rustc target
2024-03-05 10:10 ` Miguel Ojeda
@ 2024-03-05 10:23 ` Huacai Chen
0 siblings, 0 replies; 6+ messages in thread
From: Huacai Chen @ 2024-03-05 10:23 UTC (permalink / raw)
To: Miguel Ojeda
Cc: WANG Rui, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Jamie Cunliffe, Catalin Marinas,
WANG Xuerui, rust-for-linux, linux-kernel, loongarch,
loongson-kernel
On Tue, Mar 5, 2024 at 6:10 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Tue, Mar 5, 2024 at 10:58 AM Huacai Chen <chenhuacai@kernel.org> wrote:
> >
> > The base of the loongarch tree doesn't contain the arm64 modifications
> > now, so this patch is better to be applied on the rust tree with my
> > Acked-by. But if you have some trouble doing that, I can also manually
> > merge the arm64 parts to the loongarch tree, and then apply this
> > patch. Thanks.
>
> The rust tree doesn't have the arm64 changes either (i.e. they are in
> the arm64 tree), so we would have the same issue.
>
> Since it is quite late and there is no rush for this, I would suggest
> applying it after the merge window in loongarch64 and thus avoiding a
> merge. But, of course, up to you!
OK, then you just need to do nothing, I will apply at a suitable time
with your Acked-by.
Huacai
>
> Thanks!
>
> Cheers,
> Miguel
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-05 10:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-04 14:14 [PATCH] loongarch: rust: Switch to use built-in rustc target WANG Rui
2024-03-04 16:07 ` 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
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).