005-v5.17-03-Kbuild-use-std-gnu11-for-KBUILD_USERCFLAGS.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 40337d6f3d677aee7ad3052ae662d3f53dd4d5cb Mon Sep 17 00:00:00 2001
  2. From: Arnd Bergmann <[email protected]>
  3. Date: Tue, 8 Mar 2022 22:56:15 +0100
  4. Subject: [PATCH 3/3] Kbuild: use -std=gnu11 for KBUILD_USERCFLAGS
  5. As we change the C language standard for the kernel from gnu89 to
  6. gnu11, it makes sense to also update the version for user space
  7. compilation.
  8. Some users have older native compilers than what they use for
  9. kernel builds, so I considered using gnu99 as the default version
  10. for wider compatibility with gcc-4.6 and earlier.
  11. However, testing with older compilers showed that we already require
  12. HOSTCC version 5.1 as well because a lot of host tools include
  13. linux/compiler.h that uses __has_attribute():
  14. CC tools/objtool/exec-cmd.o
  15. In file included from tools/include/linux/compiler_types.h:36:0,
  16. from tools/include/linux/compiler.h:5,
  17. from exec-cmd.c:2:
  18. tools/include/linux/compiler-gcc.h:19:5: error: "__has_attribute" is not defined [-Werror=undef]
  19. Signed-off-by: Arnd Bergmann <[email protected]>
  20. Reviewed-by: Nathan Chancellor <[email protected]>
  21. Reviewed-by: Nick Desaulniers <[email protected]>
  22. Tested-by: Sedat Dilek <[email protected]>
  23. Signed-off-by: Masahiro Yamada <[email protected]>
  24. ---
  25. Makefile | 2 +-
  26. 1 file changed, 1 insertion(+), 1 deletion(-)
  27. --- a/Makefile
  28. +++ b/Makefile
  29. @@ -440,7 +440,7 @@ endif
  30. HOSTPKG_CONFIG = pkg-config
  31. export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
  32. - -O2 -fomit-frame-pointer -std=gnu89 \
  33. + -O2 -fomit-frame-pointer -std=gnu11 \
  34. -Wdeclaration-after-statement
  35. export KBUILD_USERLDFLAGS :=