Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Nathan Chancellor" <nathan@kernel.org>, "Sam James" <sam@gentoo.org>
Cc: "Kostadin Shishmanov" <kostadinshishmanov@protonmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-kbuild@vger.kernel.org
Subject: Re: Build failure with GCC 15 (-std=gnu23)
Date: Tue, 19 Nov 2024 07:53:37 +0100	[thread overview]
Message-ID: <10db3077-9409-446d-8e50-1a2a803db767@app.fastmail.com> (raw)
In-Reply-To: <20241119041550.GA573925@thelio-3990X>

On Tue, Nov 19, 2024, at 05:15, Nathan Chancellor wrote:
> On Tue, Nov 19, 2024 at 02:57:28AM +0000, Sam James wrote:
>> 
>> -std=gnu11 certainly isn't there.
>
> Ugh, this is because drivers/firmware/efi/libstub does not use
> KBUILD_CFLAGS from the rest of the kernel when targeting x86:
>
> $ sed -n '9,21p' drivers/firmware/efi/libstub/Makefile
> # non-x86 reuses KBUILD_CFLAGS, x86 does not
> cflags-y                        := $(KBUILD_CFLAGS)
>
> cflags-$(CONFIG_X86_32)         := -march=i386
> cflags-$(CONFIG_X86_64)         := -mcmodel=small
> cflags-$(CONFIG_X86)            += -m$(BITS) -D__KERNEL__ \
>                                    -fPIC -fno-strict-aliasing 
> -mno-red-zone \
>                                    -mno-mmx -mno-sse -fshort-wchar \
>                                    -Wno-pointer-sign \
>                                    $(call cc-disable-warning, 
> address-of-packed-member) \
>                                    $(call cc-disable-warning, gnu) \
>                                    -fno-asynchronous-unwind-tables \
>                                    $(CLANG_FLAGS)
>
> This isn't the first time this peculiarity has bitten us :/ sticking
> '-std=gnu11' in there should resolve that issue.

Could we revisit the decision to make x86 special here and
change it to use a modified KBUILD_CFLAGS like the other ones?

> arch/x86/boot/compressed/Makefile might need the same treatment. It
> might make sense to introduce something like 'CSTD_FLAG := -std=gnu11'
> then use that in the various places within the kernel that need it so it
> can be consistently updated in the future whenever needed. I see that
> flag in Makefile, arch/arm64/kernel/vdso32/Makefile, and
> arch/x86/Makefile.

I actually have a patch to make the entire kernel use -std=gnu2x,
but I never sent that because that requires gcc-9 or higher, and
has no real upsides: the main difference is the handling of 'bool'
types, and the std=gnu1x variant is simpler here because it avoids
using the compiler-provided "stdbool.h".

       Arnd

  parent reply	other threads:[~2024-11-19  6:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4OAhbllK7x4QJGpZjkYjtBYNLd_2whHx9oFiuZcGwtVR4hIzvduultkgfAIRZI3vQpZylu7Gl929HaYFRGeMEalWCpeMzCIIhLxxRhq4U-Y=@protonmail.com>
2024-11-18 20:56 ` Build failure with GCC 15 (-std=gnu23) Nathan Chancellor
2024-11-19  2:57   ` Sam James
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 [this message]
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=10db3077-9409-446d-8e50-1a2a803db767@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=kostadinshishmanov@protonmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=sam@gentoo.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