[PATCH 0/9] kbuild: uapi: remove usage of toolchain headers

Thomas Weißschuh posted 9 patches 1 month, 1 week ago
arch/hexagon/include/uapi/asm/sigcontext.h |  2 +-
usr/dummy-include/endian.h                 |  0
usr/dummy-include/limits.h                 |  8 ++++++++
usr/dummy-include/netinet/if_ether.h       |  0
usr/dummy-include/netinet/in.h             |  0
usr/dummy-include/stdbool.h                |  7 -------
usr/dummy-include/stddef.h                 |  8 ++++++++
usr/dummy-include/stdint.h                 | 17 +++++++++++++++++
usr/dummy-include/stdlib.h                 |  7 -------
usr/dummy-include/string.h                 | 12 ++++++++++++
usr/dummy-include/sys/ioctl.h              |  0
usr/dummy-include/sys/socket.h             | 12 ++++++++++++
usr/dummy-include/sys/time.h               |  3 +++
usr/dummy-include/sys/types.h              |  0
usr/dummy-include/time.h                   |  0
usr/dummy-include/unistd.h                 |  0
usr/include/Makefile                       | 24 +++++-------------------
17 files changed, 66 insertions(+), 34 deletions(-)
[PATCH 0/9] kbuild: uapi: remove usage of toolchain headers
Posted by Thomas Weißschuh 1 month, 1 week ago
Currently the test compilation of some UAPI headers requires a toolchain
libc headers. Remove that dependency.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (9):
      hexagon: uapi: Fix structure alignment attribute
      kbuild: uapi: test linux/bpf_perf_event.h on powerpc
      kbuild: uapi: deduplicate linux/bpf_perf_event.h exclusions
      kbuild: uapi: completely exclude linux/bpf_perf_event.h on nios2
      kbuild: uapi: only use dummy-include for headers which use libc
      kbuild: uapi: provide stub includes for some libc headers
      kbuild: uapi: use custom stub headers instead of libc ones
      kbuild: uapi: simplify libc dependency logic
      kbuild: uapi: remove now unneeded guard headers

 arch/hexagon/include/uapi/asm/sigcontext.h |  2 +-
 usr/dummy-include/endian.h                 |  0
 usr/dummy-include/limits.h                 |  8 ++++++++
 usr/dummy-include/netinet/if_ether.h       |  0
 usr/dummy-include/netinet/in.h             |  0
 usr/dummy-include/stdbool.h                |  7 -------
 usr/dummy-include/stddef.h                 |  8 ++++++++
 usr/dummy-include/stdint.h                 | 17 +++++++++++++++++
 usr/dummy-include/stdlib.h                 |  7 -------
 usr/dummy-include/string.h                 | 12 ++++++++++++
 usr/dummy-include/sys/ioctl.h              |  0
 usr/dummy-include/sys/socket.h             | 12 ++++++++++++
 usr/dummy-include/sys/time.h               |  3 +++
 usr/dummy-include/sys/types.h              |  0
 usr/dummy-include/time.h                   |  0
 usr/dummy-include/unistd.h                 |  0
 usr/include/Makefile                       | 24 +++++-------------------
 17 files changed, 66 insertions(+), 34 deletions(-)
---
base-commit: 93e7204d4b0e7b69ebbceee0dc09092e975cece3
change-id: 20260124-kbuild-uapi-libc-896f152c81d6

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH 0/9] kbuild: uapi: remove usage of toolchain headers
Posted by Nicolas Schier 3 weeks, 6 days ago
On Fri, 27 Feb 2026 07:37:58 +0100, Thomas Weißschuh wrote:
> Currently the test compilation of some UAPI headers requires a toolchain
> libc headers. Remove that dependency.

Applied to kbuild/kbuild-next.git (kbuild-next), thanks!

[1/9] hexagon: uapi: Fix structure alignment attribute
      https://git.kernel.org/kbuild/c/47bca1cb
[2/9] kbuild: uapi: test linux/bpf_perf_event.h on powerpc
      https://git.kernel.org/kbuild/c/a8c9d3cc
[3/9] kbuild: uapi: deduplicate linux/bpf_perf_event.h exclusions
      https://git.kernel.org/kbuild/c/45bd8643
[4/9] kbuild: uapi: completely exclude linux/bpf_perf_event.h on nios2
      https://git.kernel.org/kbuild/c/60a16bee
[5/9] kbuild: uapi: only use dummy-include for headers which use libc
      https://git.kernel.org/kbuild/c/0ef1b7a6
[6/9] kbuild: uapi: provide stub includes for some libc headers
      https://git.kernel.org/kbuild/c/aad94ba6
[7/9] kbuild: uapi: use custom stub headers instead of libc ones
      https://git.kernel.org/kbuild/c/579f103f
[8/9] kbuild: uapi: simplify libc dependency logic
      https://git.kernel.org/kbuild/c/510c7a57
[9/9] kbuild: uapi: remove now unneeded guard headers
      https://git.kernel.org/kbuild/c/febb5c81

Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped,
reverted or modified (e.g. trailers).

Best regards,
-- 
Nicolas

Re: [PATCH 0/9] kbuild: uapi: remove usage of toolchain headers
Posted by Nathan Chancellor 1 month ago
On Fri, Feb 27, 2026 at 07:37:58AM +0100, Thomas Weißschuh wrote:
> Currently the test compilation of some UAPI headers requires a toolchain
> libc headers. Remove that dependency.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Thomas Weißschuh (9):
>       hexagon: uapi: Fix structure alignment attribute
>       kbuild: uapi: test linux/bpf_perf_event.h on powerpc
>       kbuild: uapi: deduplicate linux/bpf_perf_event.h exclusions
>       kbuild: uapi: completely exclude linux/bpf_perf_event.h on nios2
>       kbuild: uapi: only use dummy-include for headers which use libc
>       kbuild: uapi: provide stub includes for some libc headers
>       kbuild: uapi: use custom stub headers instead of libc ones
>       kbuild: uapi: simplify libc dependency logic
>       kbuild: uapi: remove now unneeded guard headers

This is nice! For the series:

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Cheers,
Nathan
Re: [PATCH 0/9] kbuild: uapi: remove usage of toolchain headers
Posted by Nicolas Schier 1 month ago
On Fri, 27 Feb 2026 07:37:58 +0100, Thomas Weißschuh <linux@weissschuh.net> wrote:
> Currently the test compilation of some UAPI headers requires a toolchain
> libc headers. Remove that dependency.

Thanks a lot for the highly appreciated clean up!  Having -nostdinc in
UAPI header tests is good thing!

Kind regards,
Nicolas

Reviewed-by: Nicolas Schier <nsc@kernel.org>
Tested-by: Nicolas Schier <nsc@kernel.org>

-- 
Nicolas

Re: [PATCH 0/9] kbuild: uapi: remove usage of toolchain headers
Posted by Arnd Bergmann 1 month, 1 week ago
On Fri, Feb 27, 2026, at 07:37, Thomas Weißschuh wrote:
> Currently the test compilation of some UAPI headers requires a toolchain
> libc headers. Remove that dependency.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Nice work!

Acked-by: Arnd Bergmann <arnd@arndb.de>

I had toyed around with a similar series, using a slightly different
approach of always using the in-kernel nolibc headers, and making
those compile across all architectures (using empty stubs for those
that are missing syscall entry functions).

I don't care much which way we do this as long as we can build test
the headers, but I wonder what your reason was for picking this
approach over the other.

     Arnd
Re: [PATCH 0/9] kbuild: uapi: remove usage of toolchain headers
Posted by Thomas Weißschuh 1 month, 1 week ago
On Fri, Feb 27, 2026 at 10:18:41AM +0100, Arnd Bergmann wrote:
> On Fri, Feb 27, 2026, at 07:37, Thomas Weißschuh wrote:
> > Currently the test compilation of some UAPI headers requires a toolchain
> > libc headers. Remove that dependency.
> >
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> 
> Nice work!
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> 
> I had toyed around with a similar series, using a slightly different
> approach of always using the in-kernel nolibc headers, and making
> those compile across all architectures (using empty stubs for those
> that are missing syscall entry functions).
> 
> I don't care much which way we do this as long as we can build test
> the headers, but I wonder what your reason was for picking this
> approach over the other.

My goal is to reduce the reliance of the UAPI headers on libc ones.
Hopefully we can remove libc usages from the UAPI headers and then also
drop the compatibility bits from the stub headers. If we use the full nolibc
the message to UAPI authors would not be clear and new dependencies may be
introduced again.


Thomas