[PATCH V7 1/4] rust: Fix a race condition in Makefile
From: Mukesh Kumar Chaurasiya (IBM)
Date: Sun Mar 29 2026 - 12:03:31 EST
When compiling with -j1 flag in powerpc, the libproc_macro finds the
libcore.rmeta both in toolchain and local rust directory. libproc_macro
should use the toolchain provided libcore.rmeta.
So for this, make libproc_macro2 libquote and libsyn dependent on core.o
so that libcore.rmeta is generated after these 3 files are done
compiling.
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@xxxxxxxxx>
---
rust/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index 9801af2e1e02..8e62f6fcf94f 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -650,7 +650,8 @@ $(obj)/core.o: private skip_flags = $(core-skip_flags)
$(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym))
$(obj)/core.o: private rustc_target_flags = $(core-flags)
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs \
- $(wildcard $(objtree)/include/config/RUSTC_VERSION_TEXT) FORCE
+ $(wildcard $(objtree)/include/config/RUSTC_VERSION_TEXT) FORCE \
+ | $(obj)/libproc_macro2.rlib $(obj)/libquote.rlib $(obj)/libsyn.rlib FORCE
+$(call if_changed_rule,rustc_library)
ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
$(obj)/core.o: scripts/target.json
--
2.53.0