Re: [PATCH] kbuild: only clean objtool on mrproper
From: Nathan Chancellor
Date: Wed Feb 25 2026 - 16:21:20 EST
On Wed, Feb 25, 2026 at 09:23:09PM +0100, Michal Suchánek wrote:
> On Wed, Feb 25, 2026 at 01:04:17PM -0700, Nathan Chancellor wrote:
> > Wouldn't resolve_btfids need the same treatment?
>
> No, make clean runs the clean target for resolve_btfids but the tool
> remains.
That does not reproduce for me personally:
$ cat kernel/configs/btf.config
CONFIG_BPF_SYSCALL=y
# CONFIG_DEBUG_INFO_NONE is not set
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_DEBUG_INFO_BTF=y
$ make -skj"$(nproc)" ARCH=x86_64 O=build mrproper defconfig btf.config prepare
$ ls -al build/tools/{bpf/resolve_btfids/resolve_btfids,objtool/objtool}
-rwxr-xr-x 1 nathan nathan 2224456 Feb 25 13:33 build/tools/bpf/resolve_btfids/resolve_btfids
-rwxr-xr-x 1 nathan nathan 4046296 Feb 25 13:33 build/tools/objtool/objtool
$ make -skj"$(nproc)" ARCH=x86_64 O=build clean
$ ls -al build/tools/{bpf/resolve_btfids/resolve_btfids,objtool/objtool}
"build/tools/bpf/resolve_btfids/resolve_btfids": No such file or directory (os error 2)
"build/tools/objtool/objtool": No such file or directory (os error 2)
I guess resolve_btfids is not strictly required for external module
builds because vmlinux may not be present and cmd_btf_ko handles that
gracefully.
> > Also, what's the use case? Running 'make clean' then copying what
> > is left?
>
> Yes, that's what my build script has been doing for at least a decade,
> possibly mutiple decades when it was somebody else's build script.
I guess that is one way to ensure 'make clean' upholds its promise of
leaving just enough to build external modules. I had missed that in
review of this change.
Another option would be splitting tools/objtool's clean target into
clean and mrproper like the main kernel and mirroring what that does so
that objtool the binary can remain around while all its objects get
cleaned up.
Cheers,
Nathan