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

From: Masahiro Yamada
Date: Mon Apr 04 2022 - 22:20:04 EST


On Tue, Apr 5, 2022 at 2:34 AM Nick Desaulniers <ndesaulniers@xxxxxxxxxx> wrote:
>
> 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.


I wanted to make uapi headers as self-contained as possible,
but I did not see much progress.

I just fixed up some low-hanging fruits, but there are still
many remaining issues.

Thank you very much for your contribution:
https://lore.kernel.org/all/20220404175448.46200-1-ndesaulniers@xxxxxxxxxx/

If you eliminate other issues, that would be appreciated.


> >
> > What is still missing for that?



--
Best Regards
Masahiro Yamada