linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
	Linus Torvalds <torvalds@linuxfoundation.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	llvm@lists.linux.dev, linux-toolchains@vger.kernel.org
Subject: Re: [GIT PULL v2] Kbuild updates for v5.15-rc1
Date: Sat, 4 Sep 2021 11:19:55 -0500	[thread overview]
Message-ID: <20210904161955.GR1583@gate.crashing.org> (raw)
In-Reply-To: <871r644bd2.fsf@oldenburg.str.redhat.com>

On Sat, Sep 04, 2021 at 05:19:21PM +0200, Florian Weimer wrote:
> * Segher Boessenkool:
> 
> > Let me quote the original mail (I had to dig it out of the archives as
> > well, no nice threading, too lazy, sorry):
> 
> It still doesn't say why.  I did see a reference to fleeting reference
> to <stdatomic.h> and <float.h>.

Yeah...  I dug out the actual patch from linux-kbuild:

https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/commit/?h=kbuild-v5.15&id=c0891ac15f0428ffa81b2e818d416bdf3cb74ab6

The reasoning in there is completely wrong.  <stdarg.h> is not a
"userspace header".  Instead, it is a standard header, required for some
functionality in C.

It also says
"GPL 2 version of <stdarg.h> can be extracted from
http://archive.debian.org/debian/pool/main/g/gcc-4.2/gcc-4.2_4.2.4.orig.tar.gz"
which seems to suggest you cannot use stuff from GPLv3-licensed GCC.
This is just wrong.  The header in question says

"""
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
"""

And <https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=COPYING.RUNTIME>
reads in part

"""
 1. Grant of Additional Permission.

  You have permission to propagate a work of Target Code formed by
  combining the Runtime Library with Independent Modules, even if such
  propagation would otherwise violate the terms of GPLv3, provided that
  all Target Code was generated by Eligible Compilation Processes. You
  may then convey such a combination under terms of your choice,
  consistent with the licensing of the Independent Modules.
"""

which says that if you compile with GCC, then it is perfectly fine if it
uses the standard C headers, it does not make your work GPL-licenced.

> After all, <stdatomic.h> is exactly like <stdarg.h> in that it's
> possible to use its functionality even without the header file.  The
> __atomic builtins are even documented in the GCC manual (unlike
> <stdatomic.h>), which is why some programmers prefer them over the
> standard interface.  And then there's the _Atomic keyword itself, whose
> use can easily result in calls to libatomic functions, too.  So blocking
> <stdatomic.h> makes little sense to me.
> 
> I don't know enough about softfloat if blocking the inclusion of
> <float.h> is worth it.

Blocking the use of <float.h> is pretty useless: it is possible to do
millions of things in the kernel source that are frowned upon, or
actively bad, or anything in between or more extreme.  That is what code
review is for.  If it would be a common mistake (it is not afaik) you
can warn for it from checkpatch.pl or something.

The patch is just re-implementing part of the standard GCC <stdarg.h>,
so that it will only work with recent GCC (and maybe clang as well if it
implements the GCC internal interfaces correctly (i.e. compatibly) here,
and the same for other compilers).  Almost all of the <stdarg.h> GCC
itself uses is the same, but it also is compatible to the various C
standards if this header is included indirectly.  That is all just some
ifdeffery anyway, so doesn't influence compilation times noticeably, and
all that.

   - * -

So as far as I can see the motivation behind the patch is a) a
misunderstanding of what standard C headers are, are for, etc.; and b)
a misunderstanding of the GPL and the GCC runtime exception to it.  The
patch makes things worse than they were.  If on the contrary Linux would
use *more* standard compiler headers, say <stddef.h>, then insidious
bugs like that fixed by c46bbf5d2def would be prevented.


Segher

  reply	other threads:[~2021-09-04 16:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAK7LNAQ0Q6CdXaD-dVGj_e3O3JYs_crpejWKpXHYQJYxyk-1VQ@mail.gmail.com>
     [not found] ` <CAHk-=wgoX0pVqNMMOcrhq=nuOfoZB_3qihyHB3y1S8qo=MDs6w@mail.gmail.com>
2021-09-03 23:04   ` [GIT PULL v2] Kbuild updates for v5.15-rc1 Nathan Chancellor
2021-09-04  8:01     ` Florian Weimer
2021-09-04 13:19       ` Segher Boessenkool
2021-09-04 15:19         ` Florian Weimer
2021-09-04 16:19           ` Segher Boessenkool [this message]
2021-09-04 17:22           ` Linus Torvalds
2021-09-04 19:15             ` Segher Boessenkool
2021-09-04 19:58               ` Linus Torvalds
2021-09-06 15:46                 ` Segher Boessenkool
2021-09-06 16:30                   ` Linus Torvalds
2021-09-06 17:27                     ` Segher Boessenkool
2021-09-06 18:11                       ` Linus Torvalds
2021-09-06 18:27                         ` Florian Weimer
2021-09-06 19:48                           ` Segher Boessenkool
2021-09-06 20:14                             ` Jakub Jelinek
2021-09-06 21:08                               ` Linus Torvalds
2021-09-06 21:24                                 ` Linus Torvalds
2021-09-07 14:41                                   ` Segher Boessenkool
2021-09-06 21:52                                 ` Jakub Jelinek
2021-09-06 22:24                                   ` Linus Torvalds
2021-09-07 15:26                                     ` Segher Boessenkool
2021-09-07 14:52                                   ` Segher Boessenkool
2021-09-09  5:14                                     ` Masahiro Yamada
2021-09-07 14:29                                 ` Segher Boessenkool
2021-09-06  6:54             ` Florian Weimer
2021-09-06 16:02               ` Alexey Dobriyan
2021-09-08  3:09                 ` Masahiro Yamada

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=20210904161955.GR1583@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=fweimer@redhat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=torvalds@linuxfoundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).