From: Segher Boessenkool <segher@kernel.crashing.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: akpm@linux-foundation.org, linux-arch@vger.kernel.org,
Catalin Marinas <catalin.marinas@arm.com>,
masahiroy@kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] isystem: delete global -isystem compile option
Date: Mon, 2 Aug 2021 11:47:47 -0500 [thread overview]
Message-ID: <20210802164747.GN1583@gate.crashing.org> (raw)
In-Reply-To: <YQeT5QRXc3CzK9nL@localhost.localdomain>
On Mon, Aug 02, 2021 at 09:42:45AM +0300, Alexey Dobriyan wrote:
> On Sun, Aug 01, 2021 at 04:32:47PM -0500, Segher Boessenkool wrote:
> > On Sun, Aug 01, 2021 at 11:13:36PM +0300, Alexey Dobriyan wrote:
> > > In theory, it enables "leakage" of userspace headers into kernel which
> > > may present licensing problem.
> >
> > > -NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> > > +NOSTDINC_FLAGS += -nostdinc
> >
> > This is removing the compiler's own include files. These are required
> > for all kinds of basic features, and required to be compliant to the C
> > standard at all.
>
> No they are not required.
This is false, they *are* required, whenever you want to use these
features. If you do not include the required headers you get undefined
behaviour.
> Kernel uses its own bool, uintptr_t and
> static_assert, memset(), CHAR_BIT.
Yes, and it occasionally gets it wrong. Great fun. See c46bbf5d2def
for the latest episode in this saga. (Yes I know this is uapi so maybe
not the best example here, but it isn't like the kernel gets such things
wrong so often these days ;-) )
The kernel *cannot* make up its own types for this. It has to use the
types it is required to use (by C, by the ABIs, etc.) So why
reimplement this?
> noreturn, alignas newest C standard
> are next.
What is wrong with <stdalign.h> and <stdnoreturn.h>?
> This version changelog didn't mention but kernel would use
> -ffreestanding too if not other problems with the flag.
It is still true for freestanding C implementations, you just get a
severely reduced standard library,
> > These are not "userspace headers", that is what
> > -nostdinc takes care of already.
>
> They are userspace headers in the sense they are external to the project
> just like userspace programs are external to the kernel.
So you are going to rewrite all of the rest of GCC inside the kernel
project as well?
> > In the case of GCC all these headers are GPL-with-runtime-exception, so
> > claiming this can cause licensing problems is fearmongering.
>
> I agree licensing problem doesn't really exist.
> It would take gcc drop-in replacement with authors insane enough to not
> license standard headers properly.
There does still not exist a drop-in replacement for GCC, not if you
look closely and/or rely on details (like the kernel does). Some of the
differences are hidden by "linux/compiler-*.h", but hardly all.
> > I strongly advise against doing this.
>
> Kernel chose to be self-contained.
That is largely historical, imo. Nowadays this is less necessary.
Also, the kernel chose to *do* use the compiler include files. It is
you who wants to abolish that here.
> -isystem removal makes sense then.
-nostdinc -isystem $(shell $(CC) -print-file-name=include) makes sense
for that: you do indeed not want the userspace headers. Maiming the
compiler (by removing some of its functional parts, namely, its generic
headers) does not make sense.
> It will be used for intrinsics where necessary.
Like, everywhere.
Segher
WARNING: multiple messages have this Message-ID (diff)
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-arch@vger.kernel.org, Will Deacon <will@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
masahiroy@kernel.org, linux-kernel@vger.kernel.org,
Paul Mackerras <paulus@samba.org>,
akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] isystem: delete global -isystem compile option
Date: Mon, 2 Aug 2021 11:47:47 -0500 [thread overview]
Message-ID: <20210802164747.GN1583@gate.crashing.org> (raw)
In-Reply-To: <YQeT5QRXc3CzK9nL@localhost.localdomain>
On Mon, Aug 02, 2021 at 09:42:45AM +0300, Alexey Dobriyan wrote:
> On Sun, Aug 01, 2021 at 04:32:47PM -0500, Segher Boessenkool wrote:
> > On Sun, Aug 01, 2021 at 11:13:36PM +0300, Alexey Dobriyan wrote:
> > > In theory, it enables "leakage" of userspace headers into kernel which
> > > may present licensing problem.
> >
> > > -NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> > > +NOSTDINC_FLAGS += -nostdinc
> >
> > This is removing the compiler's own include files. These are required
> > for all kinds of basic features, and required to be compliant to the C
> > standard at all.
>
> No they are not required.
This is false, they *are* required, whenever you want to use these
features. If you do not include the required headers you get undefined
behaviour.
> Kernel uses its own bool, uintptr_t and
> static_assert, memset(), CHAR_BIT.
Yes, and it occasionally gets it wrong. Great fun. See c46bbf5d2def
for the latest episode in this saga. (Yes I know this is uapi so maybe
not the best example here, but it isn't like the kernel gets such things
wrong so often these days ;-) )
The kernel *cannot* make up its own types for this. It has to use the
types it is required to use (by C, by the ABIs, etc.) So why
reimplement this?
> noreturn, alignas newest C standard
> are next.
What is wrong with <stdalign.h> and <stdnoreturn.h>?
> This version changelog didn't mention but kernel would use
> -ffreestanding too if not other problems with the flag.
It is still true for freestanding C implementations, you just get a
severely reduced standard library,
> > These are not "userspace headers", that is what
> > -nostdinc takes care of already.
>
> They are userspace headers in the sense they are external to the project
> just like userspace programs are external to the kernel.
So you are going to rewrite all of the rest of GCC inside the kernel
project as well?
> > In the case of GCC all these headers are GPL-with-runtime-exception, so
> > claiming this can cause licensing problems is fearmongering.
>
> I agree licensing problem doesn't really exist.
> It would take gcc drop-in replacement with authors insane enough to not
> license standard headers properly.
There does still not exist a drop-in replacement for GCC, not if you
look closely and/or rely on details (like the kernel does). Some of the
differences are hidden by "linux/compiler-*.h", but hardly all.
> > I strongly advise against doing this.
>
> Kernel chose to be self-contained.
That is largely historical, imo. Nowadays this is less necessary.
Also, the kernel chose to *do* use the compiler include files. It is
you who wants to abolish that here.
> -isystem removal makes sense then.
-nostdinc -isystem $(shell $(CC) -print-file-name=include) makes sense
for that: you do indeed not want the userspace headers. Maiming the
compiler (by removing some of its functional parts, namely, its generic
headers) does not make sense.
> It will be used for intrinsics where necessary.
Like, everywhere.
Segher
WARNING: multiple messages have this Message-ID (diff)
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: akpm@linux-foundation.org, linux-arch@vger.kernel.org,
Catalin Marinas <catalin.marinas@arm.com>,
masahiroy@kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] isystem: delete global -isystem compile option
Date: Mon, 2 Aug 2021 11:47:47 -0500 [thread overview]
Message-ID: <20210802164747.GN1583@gate.crashing.org> (raw)
In-Reply-To: <YQeT5QRXc3CzK9nL@localhost.localdomain>
On Mon, Aug 02, 2021 at 09:42:45AM +0300, Alexey Dobriyan wrote:
> On Sun, Aug 01, 2021 at 04:32:47PM -0500, Segher Boessenkool wrote:
> > On Sun, Aug 01, 2021 at 11:13:36PM +0300, Alexey Dobriyan wrote:
> > > In theory, it enables "leakage" of userspace headers into kernel which
> > > may present licensing problem.
> >
> > > -NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> > > +NOSTDINC_FLAGS += -nostdinc
> >
> > This is removing the compiler's own include files. These are required
> > for all kinds of basic features, and required to be compliant to the C
> > standard at all.
>
> No they are not required.
This is false, they *are* required, whenever you want to use these
features. If you do not include the required headers you get undefined
behaviour.
> Kernel uses its own bool, uintptr_t and
> static_assert, memset(), CHAR_BIT.
Yes, and it occasionally gets it wrong. Great fun. See c46bbf5d2def
for the latest episode in this saga. (Yes I know this is uapi so maybe
not the best example here, but it isn't like the kernel gets such things
wrong so often these days ;-) )
The kernel *cannot* make up its own types for this. It has to use the
types it is required to use (by C, by the ABIs, etc.) So why
reimplement this?
> noreturn, alignas newest C standard
> are next.
What is wrong with <stdalign.h> and <stdnoreturn.h>?
> This version changelog didn't mention but kernel would use
> -ffreestanding too if not other problems with the flag.
It is still true for freestanding C implementations, you just get a
severely reduced standard library,
> > These are not "userspace headers", that is what
> > -nostdinc takes care of already.
>
> They are userspace headers in the sense they are external to the project
> just like userspace programs are external to the kernel.
So you are going to rewrite all of the rest of GCC inside the kernel
project as well?
> > In the case of GCC all these headers are GPL-with-runtime-exception, so
> > claiming this can cause licensing problems is fearmongering.
>
> I agree licensing problem doesn't really exist.
> It would take gcc drop-in replacement with authors insane enough to not
> license standard headers properly.
There does still not exist a drop-in replacement for GCC, not if you
look closely and/or rely on details (like the kernel does). Some of the
differences are hidden by "linux/compiler-*.h", but hardly all.
> > I strongly advise against doing this.
>
> Kernel chose to be self-contained.
That is largely historical, imo. Nowadays this is less necessary.
Also, the kernel chose to *do* use the compiler include files. It is
you who wants to abolish that here.
> -isystem removal makes sense then.
-nostdinc -isystem $(shell $(CC) -print-file-name=include) makes sense
for that: you do indeed not want the userspace headers. Maiming the
compiler (by removing some of its functional parts, namely, its generic
headers) does not make sense.
> It will be used for intrinsics where necessary.
Like, everywhere.
Segher
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-08-02 16:55 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-01 20:13 [PATCH 1/3] isystem: trim/fixup stdarg.h and other headers Alexey Dobriyan
2021-08-01 20:13 ` Alexey Dobriyan
2021-08-01 20:13 ` [PATCH 2/3] isystem: ship and use stdarg.h Alexey Dobriyan
2021-08-03 7:14 ` Ard Biesheuvel
2021-08-17 1:30 ` Masahiro Yamada
2021-08-06 13:00 ` Rafael J. Wysocki
2021-08-01 20:13 ` [PATCH 3/3] isystem: delete global -isystem compile option Alexey Dobriyan
2021-08-01 20:13 ` Alexey Dobriyan
2021-08-01 20:13 ` Alexey Dobriyan
2021-08-01 21:32 ` Segher Boessenkool
2021-08-01 21:32 ` Segher Boessenkool
2021-08-01 21:32 ` Segher Boessenkool
2021-08-02 6:42 ` Alexey Dobriyan
2021-08-02 6:42 ` Alexey Dobriyan
2021-08-02 6:42 ` Alexey Dobriyan
2021-08-02 16:47 ` Segher Boessenkool [this message]
2021-08-02 16:47 ` Segher Boessenkool
2021-08-02 16:47 ` Segher Boessenkool
2021-08-02 20:30 ` Alexey Dobriyan
2021-08-02 20:30 ` Alexey Dobriyan
2021-08-02 20:30 ` Alexey Dobriyan
2021-08-02 21:42 ` Segher Boessenkool
2021-08-02 21:42 ` Segher Boessenkool
2021-08-02 21:42 ` Segher Boessenkool
2021-08-02 1:30 ` kernel test robot
2021-08-02 1:30 ` kernel test robot
2021-08-02 18:18 ` Nathan Chancellor
2021-08-02 18:18 ` Nathan Chancellor
2021-08-02 18:18 ` Nathan Chancellor
2021-08-02 20:32 ` Alexey Dobriyan
2021-08-02 20:32 ` Alexey Dobriyan
2021-08-02 20:32 ` Alexey Dobriyan
2021-08-02 20:38 ` Nathan Chancellor
2021-08-02 20:38 ` Nathan Chancellor
2021-08-02 20:38 ` Nathan Chancellor
2021-08-02 0:21 ` [PATCH 1/3] isystem: trim/fixup stdarg.h and other headers kernel test robot
2021-08-02 0:21 ` kernel test robot
2021-08-02 0:21 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210802164747.GN1583@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=masahiroy@kernel.org \
--cc=paulus@samba.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.