Re: [PATCH v7] kbuild: host: use single executable for rustc -C linker
From: Nathan Chancellor
Date: Wed Apr 29 2026 - 21:04:27 EST
On Fri, 17 Apr 2026 00:15:23 +0300, Mohamad Alsadhan <mo@xxxxxxx> wrote:
> diff --git a/rust/Makefile b/rust/Makefile
> index 5eca6a817966..6bc761a31936 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -565,7 +565,7 @@ $(obj)/libsyn.rlib: $(src)/syn/lib.rs $(obj)/libquote.rlib FORCE
> quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
> cmd_rustc_procmacro = \
> $(RUSTC_OR_CLIPPY) $(rust_common_flags) $(rustc_target_flags) \
> - -Clinker-flavor=gcc -Clinker=$(HOSTCC) \
> + -Clinker-flavor=gcc -Clinker=scripts/rustc-wrapper \
I think this should use an explicit $(objtree)/ prefix to make it an
absolute path.
>
> diff --git a/scripts/Makefile.host b/scripts/Makefile.host
> index c1dedf646a39..84fd87a5301d 100644
> --- a/scripts/Makefile.host
> +++ b/scripts/Makefile.host
> @@ -87,11 +87,30 @@ hostcxx_flags = -Wp,-MMD,$(depfile) \
> [ ... skip 22 lines ... ]
> # `--out-dir` is required to avoid temporaries being created by `rustc` in the
> # current working directory, which may be not accessible in the out-of-tree
> # modules case.
> hostrust_flags = --out-dir $(dir $@) --emit=dep-info=$(depfile) \
> - -Clinker-flavor=gcc -Clinker=$(HOSTCC) \
> + -Clinker-flavor=gcc -Clinker=$(obj)/rustc-wrapper \
I have not been following this series too closely but it feels weird
that multiple rustc-wrapper files would be generated when their contents
should be the exact same. Would other host programs have to copy the
changes you made to .gitignore and Makefile under samples/rust/hostprogs?
What was the issue with attempting to unify these?
--
Cheers,
Nathan