lkml.org 
[lkml]   [2022]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] Kbuild: use -std=gnu11 for KBUILD_USERCFLAGS
On Tue, Mar 01, 2022 at 03:52:33PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> As we change the C language standard for the kernel from gnu89 to
> gnu11, it makes sense to also update the version for user space
> compilation.
>
> Some users have older native compilers than what they use for
> kernel builds, so I considered using gnu99 as the default version
> for wider compatibility with gcc-4.6 and earlier.
>
> However, testing with older compilers showed that we already require
> HOSTCC version 5.1 as well because a lot of host tools include
> linux/compiler.h that uses __has_attribute():
>
> CC tools/objtool/exec-cmd.o
> In file included from tools/include/linux/compiler_types.h:36:0,
> from tools/include/linux/compiler.h:5,
> from exec-cmd.c:2:
> tools/include/linux/compiler-gcc.h:19:5: error: "__has_attribute" is not defined [-Werror=undef]

For what it's worth, I think this is a bug:

https://lore.kernel.org/r/c1b1a299-c60d-28a4-07ab-1ecd211d6da9@i-love.sakura.ne.jp/
https://lore.kernel.org/r/20220102120201.594408-1-xu.xin16@zte.com.cn/

I never got clear feedback on resolving it from the first thread and
nobody bothered to pick up the second patch.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Nobody has yelled that loud though, so this is probably fine.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 37ef6a555dcd..7c9be7f1ccd4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -432,7 +432,7 @@ HOSTCXX = g++
> endif
>
> export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
> - -O2 -fomit-frame-pointer -std=gnu89 \
> + -O2 -fomit-frame-pointer -std=gnu11 \
> -Wdeclaration-after-statement
> export KBUILD_USERLDFLAGS :=
>
> --
> 2.29.2
>
>

\
 
 \ /
  Last update: 2022-03-01 18:01    [W:0.209 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site