Re: [PATCH v4 0/7] kbuild: build the userspace tools in tools/ with the kernel

From: Andrew Morton

Date: Thu Nov 12 2026 - 17:48:33 EST


On Thu, 12 Nov 2026 14:54:20 -0500 Sasha Levin <sashal@xxxxxxxxxx> wrote:

> The userspace programs under tools/ are disconnected from the rest of the
> kernel's build system. Each has its own makefiles and build framework, and
> "make" never builds them: apart from the few host tools the build itself needs,
> such as objtool and resolve_btfids, nothing under tools/ is compiled as part of
> a kernel build.
>
> That makes them easy to break. Most people, and most of the build bots, check a
> change with "make allmodconfig && make", which doesn't cover tools/ at all. A
> change that breaks a tool passes every build check and is only noticed when
> someone happens to build that tool by hand, often much later.

ooh.

A pet peeve is CONFIG_TRIM_UNUSED_KSYMS. It zaps exports which aren't
used by the current module set.

So the 20-odd selftests which build modules and then modprobe them can
find that some of the exports which they need were zapped by
CONFIG_TRIM_UNUSED_KSYMS, so their modprobe fails. This happens if the
current module set happens to not use certain exports which the
selftests need.

CONFIG_TRIM_UNUSED_KSYMS has a whitelist dont-zap-this thing but I
don't know how to populate that from the 20-odd selftests modules.

>From a high level, I think all this happens because selftests are
considered "out of tree" for kbuild purposes.

Does this patchset fix this CONFIG_TRIM_UNUSED_KSYMS-vs-sefltests thing?