Re: [PATCH 2/8] kbuild: prevent exported headers from including <stdlib.h>, <stdbool.h>

From: Nick Desaulniers
Date: Mon Apr 04 2022 - 17:51:24 EST


On Mon, Apr 04, 2022 at 12:41:54AM -0700, Christoph Hellwig wrote:
> On Mon, Apr 04, 2022 at 03:19:42PM +0900, Masahiro Yamada wrote:
> > If we can make kernel headers self-contained (that is, none of exported
> > kernel headers includes system headers), we will be able to add the
> > -nostdinc flag, but that is much far from where we stand now.

This is something I'd like to see done. IMO, the kernel headers should
be the independent variable of which the libc is the dependendent
variable.

Android's libc, Bionic, is making use of the UAPI headers. They are
doing some rewriting of UAPI headers, but I'd like to see what needs to
be upstreamed from there. I just noticed
include/uapi/linux/libc-compat.h, which seems like a good place for such
compat related issues.

In particular, having UAPI_HEADER_TESTS depend on CC_CAN_LINK is
something I think we can works towards removing. The header tests
themselves don't link; they force a dependency on a prebuilt libc
sysroot, and they only need the headers from the sysroot because of this
existing circular dependency between kernel headers and libc headers.

I'd be happy to be explicitly cc'ed on changes like this series, going
forward. Masahiro, if there's parts you'd like me to help with besides
just code review, please let me know how I can help.

>
> What is still missing for that?