* [PATCH] rust: kbuild: emit dep-info into $(depfile) directly
@ 2026-02-24 7:29 Gary Guo
2026-02-24 7:33 ` Onur Özkan
2026-03-04 2:39 ` Miguel Ojeda
0 siblings, 2 replies; 3+ messages in thread
From: Gary Guo @ 2026-02-24 7:29 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Miguel Ojeda, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Trevor Gross, Danilo Krummrich
Cc: linux-kbuild, Onur Özkan, rust-for-linux, linux-kernel
After commit 295d8398c67e ("kbuild: specify output names separately for
each emission type from rustc"), the preferred pattern is to ask rustc to
emit depedency information into $(depfile) directly, and after commit
2185242faddd ("kbuild: remove sed commands after rustc rules"), the
post-processing to remove comments is no longer necessary as fixdep can
handle comments directly. Thus, emit dep-ifno into $(depfile) directly and
remove the mv and sed invocation.
This fixes the issue where a non-ignored .d file is emitted during
compilation and removed shortly afterwards.
Reported-by: Onur Özkan <work@onurozkan.dev>
Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/syn.20artifact.20being.20tracked.20by.20git/with/575467879
Fixes: 7dbe46c0b11d ("rust: kbuild: add proc macro library support")
Signed-off-by: Gary Guo <gary@garyguo.net>
---
rust/Makefile | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/rust/Makefile b/rust/Makefile
index 629b3bdd2b20..1500993d7ecc 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -526,11 +526,9 @@ quiet_cmd_rustc_procmacrolibrary = $(RUSTC_OR_CLIPPY_QUIET) PL $@
cmd_rustc_procmacrolibrary = \
$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
$(filter-out $(skip_flags),$(rust_common_flags) $(rustc_target_flags)) \
- --emit=dep-info,link --crate-type rlib -O \
+ --emit=dep-info=$(depfile) --emit=link=$@ --crate-type rlib -O \
--out-dir $(objtree)/$(obj) -L$(objtree)/$(obj) \
- --crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $<; \
- mv $(objtree)/$(obj)/$(patsubst lib%.rlib,%,$(notdir $@)).d $(depfile); \
- sed -i '/^\#/d' $(depfile)
+ --crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $<
$(obj)/libproc_macro2.rlib: private skip_clippy = 1
$(obj)/libproc_macro2.rlib: private rustc_target_flags = $(proc_macro2-flags)
--
2.51.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] rust: kbuild: emit dep-info into $(depfile) directly
2026-02-24 7:29 [PATCH] rust: kbuild: emit dep-info into $(depfile) directly Gary Guo
@ 2026-02-24 7:33 ` Onur Özkan
2026-03-04 2:39 ` Miguel Ojeda
1 sibling, 0 replies; 3+ messages in thread
From: Onur Özkan @ 2026-02-24 7:33 UTC (permalink / raw)
To: Gary Guo
Cc: Nathan Chancellor, Nicolas Schier, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, linux-kbuild, rust-for-linux,
linux-kernel
On Tue, 24 Feb 2026 15:29:56 +0800
Gary Guo <gary@garyguo.net> wrote:
> After commit 295d8398c67e ("kbuild: specify output names separately
> for each emission type from rustc"), the preferred pattern is to ask
> rustc to emit depedency information into $(depfile) directly, and
> after commit 2185242faddd ("kbuild: remove sed commands after rustc
> rules"), the post-processing to remove comments is no longer
> necessary as fixdep can handle comments directly. Thus, emit dep-ifno
> into $(depfile) directly and remove the mv and sed invocation.
>
> This fixes the issue where a non-ignored .d file is emitted during
> compilation and removed shortly afterwards.
>
> Reported-by: Onur Özkan <work@onurozkan.dev>
> Closes:
> https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/syn.20artifact.20being.20tracked.20by.20git/with/575467879
> Fixes: 7dbe46c0b11d ("rust: kbuild: add proc macro library support")
> Signed-off-by: Gary Guo <gary@garyguo.net> ---
> rust/Makefile | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/rust/Makefile b/rust/Makefile
> index 629b3bdd2b20..1500993d7ecc 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -526,11 +526,9 @@ quiet_cmd_rustc_procmacrolibrary =
> $(RUSTC_OR_CLIPPY_QUIET) PL $@ cmd_rustc_procmacrolibrary = \
> $(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
> $(filter-out $(skip_flags),$(rust_common_flags)
> $(rustc_target_flags)) \
> - --emit=dep-info,link --crate-type rlib -O \
> + --emit=dep-info=$(depfile) --emit=link=$@
> --crate-type rlib -O \ --out-dir $(objtree)/$(obj)
> -L$(objtree)/$(obj) \
> - --crate-name $(patsubst lib%.rlib,%,$(notdir $@))
> $<; \
> - mv $(objtree)/$(obj)/$(patsubst lib%.rlib,%,$(notdir $@)).d
> $(depfile); \
> - sed -i '/^\#/d' $(depfile)
> + --crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $<
>
> $(obj)/libproc_macro2.rlib: private skip_clippy = 1
> $(obj)/libproc_macro2.rlib: private rustc_target_flags =
> $(proc_macro2-flags)
Tested-by: Onur Özkan <work@onurozkan.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] rust: kbuild: emit dep-info into $(depfile) directly
2026-02-24 7:29 [PATCH] rust: kbuild: emit dep-info into $(depfile) directly Gary Guo
2026-02-24 7:33 ` Onur Özkan
@ 2026-03-04 2:39 ` Miguel Ojeda
1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2026-03-04 2:39 UTC (permalink / raw)
To: Gary Guo
Cc: Nathan Chancellor, Nicolas Schier, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, linux-kbuild, Onur Özkan,
rust-for-linux, linux-kernel
On Tue, Feb 24, 2026 at 8:30 AM Gary Guo <gary@garyguo.net> wrote:
>
> After commit 295d8398c67e ("kbuild: specify output names separately for
> each emission type from rustc"), the preferred pattern is to ask rustc to
> emit depedency information into $(depfile) directly, and after commit
> 2185242faddd ("kbuild: remove sed commands after rustc rules"), the
> post-processing to remove comments is no longer necessary as fixdep can
> handle comments directly. Thus, emit dep-ifno into $(depfile) directly and
> remove the mv and sed invocation.
>
> This fixes the issue where a non-ignored .d file is emitted during
> compilation and removed shortly afterwards.
>
> Reported-by: Onur Özkan <work@onurozkan.dev>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/syn.20artifact.20being.20tracked.20by.20git/with/575467879
> Fixes: 7dbe46c0b11d ("rust: kbuild: add proc macro library support")
> Signed-off-by: Gary Guo <gary@garyguo.net>
Applied to `rust-fixes` -- thanks everyone!
[ Like Gary mentioned in Zulip, this likely happened due to rebasing
the builds part of the old `syn` work I had. - Miguel ]
[ Reworded for a couple of typos. - Miguel ]
Also Cc: stable@vger.kernel.org
Cheers,
Miguel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-04 2:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 7:29 [PATCH] rust: kbuild: emit dep-info into $(depfile) directly Gary Guo
2026-02-24 7:33 ` Onur Özkan
2026-03-04 2:39 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox