2
1

0001-mips-Add-std-flag-specified-in-KBUILD_CFLAGS-to-vdso.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From c94606e06b54bc7b909fb342aa8dae732b50f5cd Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Sat, 29 Mar 2025 08:39:03 -0700
  4. Subject: [PATCH] mips: Add -std= flag specified in KBUILD_CFLAGS to vdso
  5. CFLAGS
  6. GCC 15 changed the default C standard dialect from gnu17 to gnu23,
  7. which should not have impacted the kernel because it explicitly requests
  8. the gnu11 standard in the main Makefile. However, mips/vdso code uses
  9. its own CFLAGS without a '-std=' value, which break with this dialect
  10. change because of the kernel's own definitions of bool, false, and true
  11. conflicting with the C23 reserved keywords.
  12. include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
  13. 11 | false = 0,
  14. | ^~~~~
  15. include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
  16. include/linux/types.h:35:33: error: 'bool' cannot be defined via 'typedef'
  17. 35 | typedef _Bool bool;
  18. | ^~~~
  19. include/linux/types.h:35:33: note: 'bool' is a keyword with '-std=c23' onwards
  20. Add -std as specified in KBUILD_CFLAGS to the decompressor and purgatory
  21. CFLAGS to eliminate these errors and make the C standard version of these
  22. areas match the rest of the kernel.
  23. Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?id=0f4ae7c6ecb89bfda026d210dcf8216fb67d2333
  24. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  25. Cc: stable@vger.kernel.org
  26. Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  27. [Romain: backport to 6.12.27]
  28. Signed-off-by: Romain Naour <romain.naour@smile.fr>
  29. ---
  30. arch/mips/vdso/Makefile | 1 +
  31. 1 file changed, 1 insertion(+)
  32. diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
  33. index b289b2c1b294..c729bd687804 100644
  34. --- a/arch/mips/vdso/Makefile
  35. +++ b/arch/mips/vdso/Makefile
  36. @@ -27,6 +27,7 @@ endif
  37. # offsets.
  38. cflags-vdso := $(ccflags-vdso) \
  39. $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
  40. + $(filter -std=%,$(KBUILD_CFLAGS)) \
  41. -O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
  42. -mrelax-pic-calls $(call cc-option, -mexplicit-relocs) \
  43. -fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
  44. --
  45. 2.49.0