From: Rainer Fiebig <jrf@mailbox.org>
To: Sasha Levin <sashal@kernel.org>, stable@vger.kernel.org
Cc: Nathan Chancellor <nathan@kernel.org>,
Michal Suchanek <msuchanek@suse.de>,
Josh Poimboeuf <jpoimboe@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Nicolas Schier <nsc@kernel.org>
Subject: Re: [PATCH 6.18.y] kbuild: Leave objtool binary around with 'make clean'
Date: Mon, 9 Mar 2026 23:46:20 +0100 [thread overview]
Message-ID: <435dbd9c-38e2-2838-234c-6a07d6a01c1c@mailbox.org> (raw)
In-Reply-To: <20260309174349.1332818-1-sashal@kernel.org>
Am 09.03.26 um 18:43 schrieb Sasha Levin:
> From: Nathan Chancellor <nathan@kernel.org>
>
> [ Upstream commit fdb12c8a24a453bdd6759979b6ef1e04ebd4beb4 ]
>
> The difference between 'make clean' and 'make mrproper' is documented in
> 'make help' as:
>
> clean - Remove most generated files but keep the config and
> enough build support to build external modules
> mrproper - Remove all generated files + config + various backup files
>
> After commit 68b4fe32d737 ("kbuild: Add objtool to top-level clean
> target"), running 'make clean' then attempting to build an external
> module with the resulting build directory fails with
>
> $ make ARCH=x86_64 O=build clean
>
> $ make -C build M=... MO=...
> ...
> /bin/sh: line 1: .../build/tools/objtool/objtool: No such file or directory
>
> as 'make clean' removes the objtool binary.
>
> Split the objtool clean target into mrproper and clean like Kbuild does
> and remove all generated artifacts with 'make clean' except for the
> objtool binary, which is removed with 'make mrproper'. To avoid a small
> race when running the objtool clean target through both objtool_mrproper
> and objtool_clean when running 'make mrproper', modify objtool's clean
> up find command to avoid using find's '-delete' command by piping the
> files into 'xargs rm -f' like the rest of Kbuild does.
>
> Cc: stable@vger.kernel.org
> Fixes: 68b4fe32d737 ("kbuild: Add objtool to top-level clean target")
> Reported-by: Michal Suchanek <msuchanek@suse.de>
> Closes: https://lore.kernel.org/20260225112633.6123-1-msuchanek@suse.de/
> Reported-by: Rainer Fiebig <jrf@mailbox.org>
> Closes: https://lore.kernel.org/62d12399-76e5-3d40-126a-7490b4795b17@mailbox.org/
> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Reviewed-by: Nicolas Schier <nsc@kernel.org>
> Tested-by: Nicolas Schier <nsc@kernel.org>
> Link: https://patch.msgid.link/20260227-avoid-objtool-binary-removal-clean-v1-1-122f3e55eae9@kernel.org
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> [ Context ]
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> Makefile | 8 ++++----
> tools/objtool/Makefile | 8 +++++---
> 2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 35c1fcb095717..827d27605b0de 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1440,13 +1440,13 @@ ifneq ($(wildcard $(resolve_btfids_O)),)
> $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
> endif
>
> -PHONY += objtool_clean
> +PHONY += objtool_clean objtool_mrproper
>
> objtool_O = $(abspath $(objtree))/tools/objtool
>
> -objtool_clean:
> +objtool_clean objtool_mrproper:
> ifneq ($(wildcard $(objtool_O)),)
> - $(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) clean
> + $(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) $(patsubst objtool_%,%,$@)
> endif
>
> tools/: FORCE
> @@ -1623,7 +1623,7 @@ PHONY += $(mrproper-dirs) mrproper
> $(mrproper-dirs):
> $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
>
> -mrproper: clean $(mrproper-dirs)
> +mrproper: clean objtool_mrproper $(mrproper-dirs)
> $(call cmd,rmfiles)
> @find . $(RCS_FIND_IGNORE) \
> \( -name '*.rmeta' \) \
> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
> index 99d3897e046c6..b436656cd1372 100644
> --- a/tools/objtool/Makefile
> +++ b/tools/objtool/Makefile
> @@ -86,10 +86,12 @@ $(LIBSUBCMD)-clean:
> $(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT)
>
> clean: $(LIBSUBCMD)-clean
> - $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
> - $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
> + $(Q)find $(OUTPUT) \( -name '*.o' -o -name '\.*.cmd' -o -name '\.*.d' \) -type f -print | xargs $(RM)
> $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
>
> +mrproper: clean
> + $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
> +
> FORCE:
>
> -.PHONY: clean FORCE
> +.PHONY: clean mrproper FORCE
>
FWIW: the respective patches applied cleanly to 6.18.16, 6.12.75 and
6.6.128. In all three cases "make clean" worked as usual again and the
external modules (VirtualBox) built fine during boot. All good from my
perspective. Thanks!
Rainer
prev parent reply other threads:[~2026-03-09 22:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 10:30 FAILED: patch "[PATCH] kbuild: Leave objtool binary around with 'make clean'" failed to apply to 6.18-stable tree gregkh
2026-03-09 17:43 ` [PATCH 6.18.y] kbuild: Leave objtool binary around with 'make clean' Sasha Levin
2026-03-09 22:46 ` Rainer Fiebig [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=435dbd9c-38e2-2838-234c-6a07d6a01c1c@mailbox.org \
--to=jrf@mailbox.org \
--cc=jpoimboe@kernel.org \
--cc=msuchanek@suse.de \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=peterz@infradead.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox