public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mips: Add '-std=gnu11' to vdso CFLAGS
@ 2025-03-27  3:24 Khem Raj
  2025-03-28 19:57 ` Nicolas Schier
  2025-03-29  9:57 ` Thomas Bogendoerfer
  0 siblings, 2 replies; 3+ messages in thread
From: Khem Raj @ 2025-03-27  3:24 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Masahiro Yamada, Nicolas Schier, Kees Cook
  Cc: linux-mips, linux-kernel, Khem Raj, stable

GCC 15 changed the default C standard dialect from gnu17 to gnu23,
which should not have impacted the kernel because it explicitly requests
the gnu11 standard in the main Makefile. However, mips/vdso code uses
its own CFLAGS without a '-std=' value, which break with this dialect
change because of the kernel's own definitions of bool, false, and true
conflicting with the C23 reserved keywords.

  include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
     11 |         false   = 0,
        |         ^~~~~
  include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
  include/linux/types.h:35:33: error: 'bool' cannot be defined via 'typedef'
     35 | typedef _Bool                   bool;
        |                                 ^~~~
  include/linux/types.h:35:33: note: 'bool' is a keyword with '-std=c23' onwards

Add '-std=gnu11' to the decompressor and purgatory CFLAGS to eliminate
these errors and make the C standard version of these areas match the
rest of the kernel.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: stable@vger.kernel.org
---
v2: Filter the -std flag from KBUILD_CFLAGS instead of hardcoding

 arch/mips/vdso/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index fb4c493aaffa..69d4593f64fe 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -27,6 +27,7 @@ endif
 # offsets.
 cflags-vdso := $(ccflags-vdso) \
 	$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
+	$(filter -std=%,$(KBUILD_CFLAGS)) \
 	-O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
 	-mrelax-pic-calls $(call cc-option, -mexplicit-relocs) \
 	-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mips: Add '-std=gnu11' to vdso CFLAGS
  2025-03-27  3:24 [PATCH v2] mips: Add '-std=gnu11' to vdso CFLAGS Khem Raj
@ 2025-03-28 19:57 ` Nicolas Schier
  2025-03-29  9:57 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2025-03-28 19:57 UTC (permalink / raw)
  To: Khem Raj, Thomas Bogendoerfer, Masahiro Yamada, Kees Cook
  Cc: linux-mips, linux-kernel, stable

On Thu Mar 27, 2025 at 04:24 CET, Khem Raj wrote:
> GCC 15 changed the default C standard dialect from gnu17 to gnu23,
> which should not have impacted the kernel because it explicitly requests
> the gnu11 standard in the main Makefile. However, mips/vdso code uses
> its own CFLAGS without a '-std=' value, which break with this dialect
> change because of the kernel's own definitions of bool, false, and true
> conflicting with the C23 reserved keywords.
>
>   include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
>      11 |         false   = 0,
>         |         ^~~~~
>   include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
>   include/linux/types.h:35:33: error: 'bool' cannot be defined via 'typedef'
>      35 | typedef _Bool                   bool;
>         |                                 ^~~~
>   include/linux/types.h:35:33: note: 'bool' is a keyword with '-std=c23' onwards
>
> Add '-std=gnu11' to the decompressor and purgatory CFLAGS to eliminate
> these errors and make the C standard version of these areas match the
> rest of the kernel.
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: stable@vger.kernel.org
> ---
> v2: Filter the -std flag from KBUILD_CFLAGS instead of hardcoding
>
>  arch/mips/vdso/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
> index fb4c493aaffa..69d4593f64fe 100644
> --- a/arch/mips/vdso/Makefile
> +++ b/arch/mips/vdso/Makefile
> @@ -27,6 +27,7 @@ endif
>  # offsets.
>  cflags-vdso := $(ccflags-vdso) \
>  	$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
> +	$(filter -std=%,$(KBUILD_CFLAGS)) \
>  	-O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
>  	-mrelax-pic-calls $(call cc-option, -mexplicit-relocs) \
>  	-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \

Thanks.

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mips: Add '-std=gnu11' to vdso CFLAGS
  2025-03-27  3:24 [PATCH v2] mips: Add '-std=gnu11' to vdso CFLAGS Khem Raj
  2025-03-28 19:57 ` Nicolas Schier
@ 2025-03-29  9:57 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2025-03-29  9:57 UTC (permalink / raw)
  To: Khem Raj
  Cc: Masahiro Yamada, Nicolas Schier, Kees Cook, linux-mips,
	linux-kernel, stable

On Wed, Mar 26, 2025 at 08:24:36PM -0700, Khem Raj wrote:
> GCC 15 changed the default C standard dialect from gnu17 to gnu23,
> which should not have impacted the kernel because it explicitly requests
> the gnu11 standard in the main Makefile. However, mips/vdso code uses
> its own CFLAGS without a '-std=' value, which break with this dialect
> change because of the kernel's own definitions of bool, false, and true
> conflicting with the C23 reserved keywords.
> 
>   include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
>      11 |         false   = 0,
>         |         ^~~~~
>   include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
>   include/linux/types.h:35:33: error: 'bool' cannot be defined via 'typedef'
>      35 | typedef _Bool                   bool;
>         |                                 ^~~~
>   include/linux/types.h:35:33: note: 'bool' is a keyword with '-std=c23' onwards
> 
> Add '-std=gnu11' to the decompressor and purgatory CFLAGS to eliminate
> these errors and make the C standard version of these areas match the
> rest of the kernel.

please adapt subject and description.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-29  9:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-27  3:24 [PATCH v2] mips: Add '-std=gnu11' to vdso CFLAGS Khem Raj
2025-03-28 19:57 ` Nicolas Schier
2025-03-29  9:57 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox