Re: [PATCH] kbuild: rust: avoid creating temporary files

From: Masahiro Yamada
Date: Sun Jul 23 2023 - 01:07:01 EST


On Sun, Jul 23, 2023 at 12:52 AM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> On Thu, Jul 20, 2023 at 8:35 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > Maybe, the following was a breakage.
> >
> > commit 295d8398c67e314d99bb070f38883f83fe94a97a
> > Author: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> > Date: Sat Jan 7 18:18:15 2023 +0900
> >
> > kbuild: specify output names separately for each emission type from rustc
> >
> > Before that, rust_common_cmd had --out-dir.
>
> That's right, good catch!
>
> > BTW, do we also need to fix scripts/Makefile.host
> > in case the external module Makefile creates host programs?
>
> Indeed, we need it too. [1] would fix it (tested it with a trivial
> out-of-tree Rust hostprog).
>
> Do you want me to send it separately? i.e. to avoid losing the
> `Tested-by`s etc. that we already got for this one, which is the
> important one since that actually has users.
>
> The hostprogs fix is not really critical for stable, since it is
> unlikely there are users at all (we just got the first in-tree real
> user in the Rust+KUnit integration coming into 6.6), but I guess it
> does not hurt for the same reason.


Can you send v2 with the following squashed?


I think it makes sense to fix both if we add
Fixes: 295d8398c67e ("kbuild: specify output names separately for each
emission type from rustc")





> Thanks!
>
> Cheers,
> Miguel
>
> [1]
>
> diff --git a/scripts/Makefile.host b/scripts/Makefile.host
> index 7aea9005e497..54adf2e2ec51 100644
> --- a/scripts/Makefile.host
> +++ b/scripts/Makefile.host
> @@ -86,7 +86,7 @@ hostc_flags = -Wp,-MMD,$(depfile) \
> hostcxx_flags = -Wp,-MMD,$(depfile) \
> $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
> $(HOSTCXXFLAGS_$(target-stem).o)
> -hostrust_flags = --emit=dep-info=$(depfile) \
> +hostrust_flags = --out-dir $(dir $@) --emit=dep-info=$(depfile) \
> $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
> $(HOSTRUSTFLAGS_$(target-stem))



--
Best Regards
Masahiro Yamada