Re: [PATCH] x86/build: don't add -maccumulate-outgoing-args w/o compiler support

From: Josh Poimboeuf
Date: Thu May 04 2017 - 15:14:20 EST


On Wed, May 03, 2017 at 11:23:41PM -0700, Nick Desaulniers wrote:
> Otherwise other compilers, like Clang, are prevented from compiling the
> kernel. This flag was introduced in
> 3f135e57a4f76d24ae8d8a490314331f0ced40c5.
>
> Signed-off-by: Nick Desaulniers <nick.desaulniers@xxxxxxxxx>
> ---
> arch/x86/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 4430dd4..5a0ac84 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -179,7 +179,7 @@ ifdef CONFIG_JUMP_LABEL
> endif
>
> ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1)
> - KBUILD_CFLAGS += -maccumulate-outgoing-args
> + KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,)
> endif

I think this might silently cover up errors for older versions of gcc.
For example, what happens if '-maccumulate-outgoing-args' is needed, but
the version of gcc doesn't support it. In that case I'd rather see gcc
report an error that the flag isn't supported, instead of it getting
silently disabled.

So how about this instead?

KBUILD_CFLAGS += $(if $(filter gcc,$(cc-name)),-maccumulate-outgoing-args)

--
Josh