This commit switches to use the LoongArch's built-in rustc target 'loongarch64-unknown-none-softfloat'. The Rust samples have been tested.
Unified · Split
| @@ -101,7 +101,7 @@ ifdef CONFIG_OBJTOOL · 100 unmodified lines | |||
| 101 | KBUILD_CFLAGS += -fno-jump-tables | 101 | KBUILD_CFLAGS += -fno-jump-tables |
| 102 | endif | 102 | endif |
| 103 | 103 | ||
| 104 | KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json | 104 | KBUILD_RUSTFLAGS += --target=loongarch64-unknown-none-softfloat |
| 105 | KBUILD_RUSTFLAGS_MODULE += -Crelocation-model=pic | 105 | KBUILD_RUSTFLAGS_MODULE += -Crelocation-model=pic |
| 106 | 106 | ||
| 107 | ifeq ($(CONFIG_RELOCATABLE),y) | 107 | ifeq ($(CONFIG_RELOCATABLE),y) |
| @@ -436,7 +436,7 @@ $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--re · 435 unmodified lines | |||
| 436 | $(obj)/core.o: private rustc_target_flags = $(core-cfgs) | 436 | $(obj)/core.o: private rustc_target_flags = $(core-cfgs) |
| 437 | $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs FORCE | 437 | $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs FORCE |
| 438 | +$(call if_changed_dep,rustc_library) | 438 | +$(call if_changed_dep,rustc_library) |
| 439 | ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),) | 439 | ifdef CONFIG_X86_64 |
| 440 | $(obj)/core.o: scripts/target.json | 440 | $(obj)/core.o: scripts/target.json |
| 441 | endif | 441 | endif |
| 442 | 442 | ||
| @@ -12,7 +12,7 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert · 11 unmodified lines | |||
| 12 | hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_builder | 12 | hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_builder |
| 13 | hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_gen | 13 | hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_gen |
| 14 | 14 | ||
| 15 | ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),) | 15 | ifdef CONFIG_X86_64 |
| 16 | always-$(CONFIG_RUST) += target.json | 16 | always-$(CONFIG_RUST) += target.json |
| 17 | filechk_rust_target = $< < include/config/auto.conf | 17 | filechk_rust_target = $< < include/config/auto.conf |
| 18 | 18 | ||
| @@ -164,12 +164,7 @@ fn main() { · 163 unmodified lines | |||
| 164 | ts.push("llvm-target", "x86_64-linux-gnu"); | 164 | ts.push("llvm-target", "x86_64-linux-gnu"); |
| 165 | ts.push("target-pointer-width", "64"); | 165 | ts.push("target-pointer-width", "64"); |
| 166 | } else if cfg.has("LOONGARCH") { | 166 | } else if cfg.has("LOONGARCH") { |
| 167 | ts.push("arch", "loongarch64"); | 167 | panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target"); |
| 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"); | ||
| 173 | } else { | 168 | } else { |
| 174 | panic!("Unsupported architecture"); | 169 | panic!("Unsupported architecture"); |
| 175 | } | 170 | } |