History

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.

WANG Rui committed 2 years ago

Commit 8f8d74e1 parent d6af2c74 files · +4 −9Browse files

Unified · Split

4 files
  1. arch/loongarch/Makefile +1 −1
  2. rust/Makefile +1 −1
  3. scripts/Makefile +1 −1
  4. scripts/generate_rust_target.rs +1 −6
arch/loongarch/Makefile+1−1
@@ -101,7 +101,7 @@ ifdef CONFIG_OBJTOOL · 100 unmodified lines
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+1−1
@@ -436,7 +436,7 @@ $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--re · 435 unmodified lines
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+1−1
@@ -12,7 +12,7 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert · 11 unmodified lines
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+1−6
@@ -164,12 +164,7 @@ fn main() { · 163 unmodified lines
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 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t