arch/s390/Makefile | 2 +- arch/s390/purgatory/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
GCC 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, there are certain
places in the s390 code that use their 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.
Cc: stable@vger.kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
I only see one other error in various files with a recent GCC 15.0.1
snapshot, which I can eliminate by dropping the version part of the
condition for CONFIG_GCC_ASM_FLAG_OUTPUT_BROKEN. Is this a regression of
the fix for the problem of GCC 14.2.0 or is something else doing on
here?
arch/s390/include/asm/bitops.h: Assembler messages:
arch/s390/include/asm/bitops.h:60: Error: operand 1: syntax error; missing ')' after base register
arch/s390/include/asm/bitops.h:60: Error: operand 2: syntax error; ')' not allowed here
arch/s390/include/asm/bitops.h:60: Error: junk at end of line: `,4'
arch/s390/include/asm/bitops.h:60: Error: operand 1: syntax error; missing ')' after base register
arch/s390/include/asm/bitops.h:60: Error: operand 2: syntax error; ')' not allowed here
arch/s390/include/asm/bitops.h:60: Error: junk at end of line: `,64'
arch/s390/include/asm/bitops.h:60: Error: operand 1: syntax error; missing ')' after base register
arch/s390/include/asm/bitops.h:60: Error: operand 2: syntax error; ')' not allowed here
arch/s390/include/asm/bitops.h:60: Error: junk at end of line: `,4'
make[6]: *** [scripts/Makefile.build:194: fs/gfs2/glock.o] Error 1
---
arch/s390/Makefile | 2 +-
arch/s390/purgatory/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 3f25498dac65..5fae311203c2 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -22,7 +22,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
ifndef CONFIG_AS_IS_LLVM
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
endif
-KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack
+KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11
KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain
diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
index 24eccaa29337..bdcf2a3b6c41 100644
--- a/arch/s390/purgatory/Makefile
+++ b/arch/s390/purgatory/Makefile
@@ -13,7 +13,7 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
$(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
$(call if_changed_rule,as_o_S)
-KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
+KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
---
base-commit: b2832409e00b6330781458d7db0080508a35a9a8
change-id: 20250122-s390-fix-std-for-gcc-15-0abfa4caf757
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
On Wed, Jan 22, 2025 at 07:54:27PM -0700, Nathan Chancellor wrote: > GCC 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, there are certain > places in the s390 code that use their 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. > > Cc: stable@vger.kernel.org > Signed-off-by: Nathan Chancellor <nathan@kernel.org> ... > --- > arch/s390/Makefile | 2 +- > arch/s390/purgatory/Makefile | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) Applied, thanks!
On Thu, Jan 23, 2025 at 11:40:40AM +0100, Alexander Gordeev wrote: > On Wed, Jan 22, 2025 at 07:54:27PM -0700, Nathan Chancellor wrote: > > GCC 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, there are certain > > places in the s390 code that use their 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. > > > > Cc: stable@vger.kernel.org > > Signed-off-by: Nathan Chancellor <nathan@kernel.org> > ... > > --- > > arch/s390/Makefile | 2 +- > > arch/s390/purgatory/Makefile | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > Applied, thanks! I noticed that a Fixes tag got added to this change in the s390 tree but I do not think it is correct, as I would expect this issue to be visible prior to that change. I think this will need to go back to all supported stable versions to allow building with GCC 15. It seems like maybe the tags from the parent commit (0a89123deec3) made it into my change? Cheers, Nathan
On Mon, Jan 27, 2025 at 02:09:36PM -0700, Nathan Chancellor wrote:
> On Thu, Jan 23, 2025 at 11:40:40AM +0100, Alexander Gordeev wrote:
> > > 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.
> > >
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ...
> > > ---
> > > arch/s390/Makefile | 2 +-
> > > arch/s390/purgatory/Makefile | 2 +-
> > > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > Applied, thanks!
>
> I noticed that a Fixes tag got added to this change in the s390 tree but
> I do not think it is correct, as I would expect this issue to be visible
> prior to that change. I think this will need to go back to all supported
> stable versions to allow building with GCC 15. It seems like maybe the
> tags from the parent commit (0a89123deec3) made it into my change?
Yes, looks like b4 picked up the tags from my inline patch I sent as
reply to your patch. The following tags shouldn't have been added:
+ Closes: https://lore.kernel.org/r/20250122-s390-fix-std-for-gcc-15-v1-1-8b00cadee083@kernel.org
+ Fixes: b2bc1b1a77c0 ("s390/bitops: Provide optimized arch_test_bit()")
+ Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Alexander?
> > I noticed that a Fixes tag got added to this change in the s390 tree but
> > I do not think it is correct, as I would expect this issue to be visible
> > prior to that change. I think this will need to go back to all supported
> > stable versions to allow building with GCC 15. It seems like maybe the
> > tags from the parent commit (0a89123deec3) made it into my change?
>
> Yes, looks like b4 picked up the tags from my inline patch I sent as
> reply to your patch. The following tags shouldn't have been added:
>
> + Closes: https://lore.kernel.org/r/20250122-s390-fix-std-for-gcc-15-v1-1-8b00cadee083@kernel.org
> + Fixes: b2bc1b1a77c0 ("s390/bitops: Provide optimized arch_test_bit()")
> + Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
>
> Alexander?
Yes, I think that is exactly what happened.
@Nathan, thanks a lot for pointing this out!
On Tue, Jan 28, 2025 at 09:25:47AM +0100, Alexander Gordeev wrote:
> > > I noticed that a Fixes tag got added to this change in the s390 tree but
> > > I do not think it is correct, as I would expect this issue to be visible
> > > prior to that change. I think this will need to go back to all supported
> > > stable versions to allow building with GCC 15. It seems like maybe the
> > > tags from the parent commit (0a89123deec3) made it into my change?
> >
> > Yes, looks like b4 picked up the tags from my inline patch I sent as
> > reply to your patch. The following tags shouldn't have been added:
> >
> > + Closes: https://lore.kernel.org/r/20250122-s390-fix-std-for-gcc-15-v1-1-8b00cadee083@kernel.org
> > + Fixes: b2bc1b1a77c0 ("s390/bitops: Provide optimized arch_test_bit()")
> > + Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> >
> > Alexander?
>
> Yes, I think that is exactly what happened.
>
> @Nathan, thanks a lot for pointing this out!
Aha, that definitely makes sense. The result looks good to me now,
thanks for the quick fix!
Cheers,
Nathan
On Wed, Jan 22, 2025 at 07:54:27PM -0700, Nathan Chancellor wrote:
> GCC 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, there are certain
> places in the s390 code that use their 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.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
Thanks!
Tested-by: Heiko Carstens <hca@linux.ibm.com>
Alexander, can you pick this up, please?
> I only see one other error in various files with a recent GCC 15.0.1
> snapshot, which I can eliminate by dropping the version part of the
> condition for CONFIG_GCC_ASM_FLAG_OUTPUT_BROKEN. Is this a regression of
> the fix for the problem of GCC 14.2.0 or is something else doing on
> here?
>
> arch/s390/include/asm/bitops.h: Assembler messages:
> arch/s390/include/asm/bitops.h:60: Error: operand 1: syntax error; missing ')' after base register
> arch/s390/include/asm/bitops.h:60: Error: operand 2: syntax error; ')' not allowed here
> arch/s390/include/asm/bitops.h:60: Error: junk at end of line: `,4'
That is I bug I recently introduced.
The patch below fixes that. Thanks for reporting!
From 2f58027ec1302714bb4d728b08dc5c88498d18b1 Mon Sep 17 00:00:00 2001
From: Heiko Carstens <hca@linux.ibm.com>
Date: Thu, 23 Jan 2025 09:14:15 +0100
Subject: [PATCH] s390/bitops: Use correct constraint for arch_test_bit()
inline assembly
Use the "Q" instead of "R" constraint to correctly reflect the instruction
format of the tm instruction: the first operand is a memory reference
without index register and short displacement. The "R" constraint indicates
a memory reference with index register instead.
This may lead to compile errors like:
arch/s390/include/asm/bitops.h: Assembler messages:
arch/s390/include/asm/bitops.h:60: Error: operand 1: syntax error; missing ')' after base register
arch/s390/include/asm/bitops.h:60: Error: operand 2: syntax error; ')' not allowed here
arch/s390/include/asm/bitops.h:60: Error: junk at end of line: `,4'
Reported-by: Nathan Chancellor <nathan@kernel.org>
Closes: https://lore.kernel.org/r/20250122-s390-fix-std-for-gcc-15-v1-1-8b00cadee083@kernel.org
Fixes: b2bc1b1a77c0 ("s390/bitops: Provide optimized arch_test_bit()")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
arch/s390/include/asm/bitops.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 15aa64e3020e..d5125296ade2 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -60,7 +60,7 @@ static __always_inline bool arch_test_bit(unsigned long nr, const volatile unsig
asm volatile(
" tm %[addr],%[mask]\n"
: "=@cc" (cc)
- : [addr] "R" (*addr), [mask] "I" (mask)
+ : [addr] "Q" (*addr), [mask] "I" (mask)
);
return cc == 3;
}
--
2.45.2
© 2016 - 2025 Red Hat, Inc.