public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Kostadin Shishmanov <kostadinshishmanov@protonmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	arnd@arndb.de,  linux-kbuild@vger.kernel.org
Subject: Re: Build failure with GCC 15 (-std=gnu23)
Date: Tue, 19 Nov 2024 02:57:28 +0000	[thread overview]
Message-ID: <8734joj5gn.fsf@gentoo.org> (raw)
In-Reply-To: <20241118205629.GA15698@thelio-3990X> (Nathan Chancellor's message of "Mon, 18 Nov 2024 13:56:29 -0700")

Nathan Chancellor <nathan@kernel.org> writes:

> Hi Kostadin,
>
> Just a quick FYI off the bat, you only directed this to LKML, which is
> basically like sending it into the void because very few people actually
> read every message on LKML. I only caught it because I have a filter set
> up for mentions of Clang and LLVM. I'd suggest adding at least the
> Kbuild mailing list, which I have done now. I have also added Arnd
> because I seem to recall him looking into how hard it would be to build
> the kernel with C23.

FWIW, scripts/get_maintainers.pl for stddef.h and types.h doesn't
include kbuild -- maybe we should add that in.

>
> On Mon, Nov 18, 2024 at 02:26:49PM +0000, Kostadin Shishmanov wrote:
>> Whenever I try to build the kernel with upcoming GCC 15 which defaults to -std=gnu23 I get a build failure:
>> 
>> ```
>> In file included from ./include/uapi/linux/posix_types.h:5,
>>                  from ./include/uapi/linux/types.h:14,
>>                  from ./include/linux/types.h:6,
>>                  from ./include/uapi/linux/mei_uuid.h:12,
>>                  from ./include/uapi/linux/mei.h:10,
>>                  from ./include/linux/mod_devicetable.h:12,
>>                  from scripts/mod/devicetable-offsets.c:3:
>> ./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
>>    11 |         false   = 0,
>> ./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
>>    35 | typedef _Bool                   bool;
>> ./include/linux/types.h:35:1: warning: useless type name in empty declaration
>>    35 | typedef _Bool                   bool;
>> ```
>> 
>> This can be reproduced on older GCC versions with KCFLAGS="-std=gnu23"
>
> The kernel builds explicitly with '-std=gnu11' (see Makefile), so I
> would not expect the default switch on the GCC side to matter. That
> signals to me that we are not actually using that flag everywhere
> then?

Right, that's the conclusion I reached when discussing it with Kostadin.

> Building with V=1, I can see '-std=gnu11' in the compiler command for
> scripts/mod/devicetable-offsets.s, which is generated from
> scripts/mod/devicetable-offsets.c, so it seems like something else is
> going on here?

I can reproduce it with `make defconfig` at
158f238aa69d91ad74e535c73f552bd4b025109c in Linus' tree with just `make
V=1 -j$(nproc) -l$(nproc)` (i.e. no CFLAGS manipulation at all).

```
# CC      drivers/firmware/efi/libstub/x86-5lvl.o
  gcc -Wp,-MMD,drivers/firmware/efi/libstub/.x86-5lvl.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/genera
ted/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__
 -fmacro-prefix-map=./= -mcmodel=small -m64 -D__KERNEL__ -fPIC -fno-strict-aliasing -mno-red-zone -mno-mmx -mno-sse -fshort-wchar -Wno-pointer-sign -Wno-address-of-packed-member -fno-asy
nchronous-unwind-tables -Os -DDISABLE_BRANCH_PROFILING -include ./include/linux/hidden.h -D__NO_FORTIFY -ffreestanding -fno-stack-protector -D__DISABLE_EXPORTS    -DKBUILD_MODFILE='"driv
ers/firmware/efi/libstub/x86-5lvl"' -DKBUILD_BASENAME='"x86_5lvl"' -DKBUILD_MODNAME='"x86_5lvl"' -D__KBUILD_MODNAME=kmod_x86_5lvl -c -o drivers/firmware/efi/libstub/x86-5lvl.o drivers/fi
rmware/efi/libstub/x86-5lvl.c
In file included from ./include/uapi/linux/posix_types.h:5,
                 from ./include/uapi/linux/types.h:14,
                 from ./include/linux/types.h:6,
                 from ./include/linux/kasan-checks.h:5,
                 from ./include/asm-generic/rwonce.h:26,
                 from ./arch/x86/include/generated/asm/rwonce.h:1,
                 from ./include/linux/compiler.h:317,
                 from ./include/linux/build_bug.h:5,
                 from ./include/linux/init.h:5,
                 from ./include/linux/efi.h:15,
                 from drivers/firmware/efi/libstub/file.c:10:
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
   11 |         false   = 0,
      |         ^~~~~
```

-std=gnu11 certainly isn't there.

>
> [...]

thanks,
sam

  reply	other threads:[~2024-11-19  2:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18 14:26 Build failure with GCC 15 (-std=gnu23) Kostadin Shishmanov
2024-11-18 20:56 ` Nathan Chancellor
2024-11-19  2:57   ` Sam James [this message]
2024-11-19  4:15     ` Nathan Chancellor
2024-11-19  4:24       ` Sam James
2024-11-19  4:47         ` Nathan Chancellor
2024-11-19 18:28           ` Masahiro Yamada
2025-01-21  0:16             ` Kees Cook
2025-01-21 21:53               ` Nathan Chancellor
2025-01-21 22:11                 ` Sam James
2025-01-21 22:51                   ` Nathan Chancellor
2024-11-19  6:53       ` Arnd Bergmann
2024-11-19 14:18         ` Nathan Chancellor

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=8734joj5gn.fsf@gentoo.org \
    --to=sam@gentoo.org \
    --cc=arnd@arndb.de \
    --cc=kostadinshishmanov@protonmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox