Re: [PATCH] kbuild: Leave objtool binary around with 'make clean'

From: Nicolas Schier

Date: Sat Feb 28 2026 - 02:39:01 EST


On Fri, Feb 27, 2026 at 10:40:48PM -0700, Nathan Chancellor wrote:
> 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'.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 68b4fe32d737 ("kbuild: Add objtool to top-level clean target")
> Reported-by: Michal Suchanek <msuchanek@xxxxxxx>
> Closes: https://lore.kernel.org/20260225112633.6123-1-msuchanek@xxxxxxx/
> Reported-by: Rainer Fiebig <jrf@xxxxxxxxxxx>
> Closes: https://lore.kernel.org/62d12399-76e5-3d40-126a-7490b4795b17@xxxxxxxxxxx/
> Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> ---
> I realize that this will technically decend into tools/objtool twice
> during cleaning when running mrproper but I don't think it is the end of
> the world for a much simpler implementation.

Yes, I think that should be ok.

Reviewed-by: Nicolas Schier <nsc@xxxxxxxxxx>
Tested-by: Nicolas Schier <nsc@xxxxxxxxxx>


--
Nicolas