Skip to content

Commit 8f8d74e

Browse files
heiherchenhuacai
authored andcommitted
LoongArch: rust: Switch to use built-in rustc target
This commit switches to use the LoongArch's built-in rustc target 'loongarch64-unknown-none-softfloat'. The Rust samples have been tested. Acked-by: Miguel Ojeda <ojeda@kernel.org> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: WANG Rui <wangrui@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent d6af2c7 commit 8f8d74e

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

arch/loongarch/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ ifdef CONFIG_OBJTOOL
101101
KBUILD_CFLAGS += -fno-jump-tables
102102
endif
103103

104-
KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
104+
KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat
105105
KBUILD_RUSTFLAGS_MODULE += -Crelocation-model=pic
106106

107107
ifeq ($(CONFIG_RELOCATABLE),y)

rust/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--re
436436
$(obj)/core.o: private rustc_target_flags = $(core-cfgs)
437437
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
438438
+$(call if_changed_dep,rustc_library)
439-
ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),)
439+
ifdef CONFIG_X86_64
440440
$(obj)/core.o: scripts/target.json
441441
endif
442442

scripts/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
1212
hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_builder
1313
hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_gen
1414

15-
ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),)
15+
ifdef CONFIG_X86_64
1616
always-$(CONFIG_RUST) += target.json
1717
filechk_rust_target = $< < include/config/auto.conf
1818

scripts/generate_rust_target.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,7 @@ fn main() {
164164
ts.push("llvm-target", "x86_64-linux-gnu");
165165
ts.push("target-pointer-width", "64");
166166
} else if cfg.has("LOONGARCH") {
167-
ts.push("arch", "loongarch64");
168-
ts.push("data-layout", "e-m:e-p:64:64-i64:64-i128:128-n64-S128");
169-
ts.push("features", "-f,-d");
170-
ts.push("llvm-target", "loongarch64-linux-gnusf");
171-
ts.push("llvm-abiname", "lp64s");
172-
ts.push("target-pointer-width", "64");
167+
panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target");
173168
} else {
174169
panic!("Unsupported architecture");
175170
}

0 commit comments

Comments
 (0)