public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: "Josh Poimboeuf" <jpoimboe@kernel.org>,
	linux-kbuild@vger.kernel.org, "Nicolas Schier" <nsc@kernel.org>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org, "Jiri Slaby" <jslaby@suse.cz>
Subject: Re: [PATCH] kbuild: only clean objtool on mrproper
Date: Fri, 27 Feb 2026 22:53:46 -0700	[thread overview]
Message-ID: <20260228055346.GA2321981@ax162> (raw)
In-Reply-To: <20260225212105.GG2755225@ax162>

On Wed, Feb 25, 2026 at 02:21:05PM -0700, Nathan Chancellor wrote:
> 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.

To close the loop here, 'make clean' removes vmlinux and resolve_btfids
at the same time and the check in cmd_btf_ko prevents that from becoming
a hard error. So technically no problem but a little fragile.

> > > 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.

FWIW, I sent this as an alternative since I think it adheres a little
more to Kbuild's contract that 'make clean' leaves enough around for
external module builds while removing all unneeded generated files:

  https://lore.kernel.org/20260227-avoid-objtool-binary-removal-clean-v1-1-122f3e55eae9@kernel.org/

Cheers,
Nathan

  reply	other threads:[~2026-02-28  5:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 11:26 [PATCH] kbuild: only clean objtool on mrproper Michal Suchanek
2026-02-25 20:04 ` Nathan Chancellor
2026-02-25 20:23   ` Michal Suchánek
2026-02-25 20:37     ` Josh Poimboeuf
2026-03-03 16:22       ` Michal Suchánek
2026-02-25 21:21     ` Nathan Chancellor
2026-02-28  5:53       ` Nathan Chancellor [this message]
2026-03-03 16:27       ` Michal Suchánek

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=20260228055346.GA2321981@ax162 \
    --to=nathan@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=masahiroy@kernel.org \
    --cc=msuchanek@suse.de \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tamird@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