From c504d83a6edd963e2ba58ec538e3f06da78b187e Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Tue, 23 Jan 2024 16:22:33 +0800 Subject: [PATCH] rust: Fix LoongArch using generated targets Signed-off-by: WANG Rui --- arch/loongarch/Makefile | 1 + rust/Makefile | 2 +- scripts/Makefile | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index 983aa2b1629a69..fa4fb09909aeb1 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -82,6 +82,7 @@ KBUILD_AFLAGS_MODULE += -Wa,-mla-global-with-abs KBUILD_CFLAGS_MODULE += -fplt -Wa,-mla-global-with-abs,-mla-local-with-abs endif +KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json KBUILD_RUSTFLAGS_MODULE += -Crelocation-model=pic ifeq ($(CONFIG_RELOCATABLE),y) diff --git a/rust/Makefile b/rust/Makefile index cb40a1ce133158..fe045dbc701ead 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) -ifdef CONFIG_X86_64 +ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),) $(obj)/core.o: scripts/target.json endif diff --git a/scripts/Makefile b/scripts/Makefile index c85d130a4125bd..6673cbb6194fe0 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 -ifdef CONFIG_X86_64 +ifneq ($(or $(CONFIG_X86_64),$(CONFIG_LOONGARCH)),) always-$(CONFIG_RUST) += target.json filechk_rust_target = $< < include/config/auto.conf