[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNATecXbEZZCxb3p9hBe7wHsLkhpavELCFbX7=ZM2hTV7sg@mail.gmail.com>
Date: Mon, 4 Apr 2022 17:03:19 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 2/8] kbuild: prevent exported headers from including
<stdlib.h>, <stdbool.h>
On Mon, Apr 4, 2022 at 4:41 PM Christoph Hellwig <hch@...radead.org> 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.
>
> What is still missing for that?
I changed as follows:
diff --git a/usr/include/Makefile b/usr/include/Makefile
index fa9819e022b7..169fca1a0f28 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -15,7 +15,7 @@ UAPI_CFLAGS += $(filter -m32 -m64 --target=%,
$(KBUILD_CFLAGS))
# USERCFLAGS might contain sysroot location for CC.
UAPI_CFLAGS += $(USERCFLAGS)
-override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include
+override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile)
-I$(objtree)/usr/include -nostdinc
# The following are excluded for now because they fail to build.
#
I got this:
masahiro@...ver:~/ref/linux$ make -j8 allyesconfig usr/include/
#
# No change to .config
#
DESCEND objtool
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
HDRTEST usr/include/linux/wireless.h
HDRTEST usr/include/linux/atmlec.h
HDRTEST usr/include/linux/if_fc.h
HDRTEST usr/include/linux/iso_fs.h
HDRTEST usr/include/linux/sysinfo.h
HDRTEST usr/include/linux/un.h
HDRTEST usr/include/linux/ax25.h
HDRTEST usr/include/linux/map_to_14segment.h
In file included from ./usr/include/linux/wireless.h:75,
from <command-line>:
./usr/include/linux/if.h:28:10: fatal error: sys/socket.h: No such
file or directory
28 | #include <sys/socket.h> /* for struct
sockaddr. */
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [usr/include/Makefile:101:
usr/include/linux/wireless.hdrtest] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:550: usr/include] Error 2
make[1]: *** [Makefile:1834: usr] Error 2
make: *** [Makefile:350: __build_one_by_one] Error 2
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists