diff mbox series

[03/14] MIPS: Prefer cc-option for additions to cflags

Message ID 20221228-drop-qunused-arguments-v1-3-658cbc8fc592@kernel.org (mailing list archive)
State New, archived
Headers show
Series Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS | expand

Commit Message

Nathan Chancellor Jan. 4, 2023, 7:54 p.m. UTC
A future change will switch as-option to use KBUILD_AFLAGS instead of
KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
issues if the flag being tested requires a flag previously added to
KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
so that the flags are tested properly.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: tsbogend@alpha.franken.de
Cc: linux-mips@vger.kernel.org
---
 arch/mips/Makefile             | 2 +-
 arch/mips/loongson2ef/Platform | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Nick Desaulniers Jan. 9, 2023, 9:21 p.m. UTC | #1
On Wed, Jan 4, 2023 at 11:54 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> A future change will switch as-option to use KBUILD_AFLAGS instead of
> KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
> issues if the flag being tested requires a flag previously added to
> KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
> so that the flags are tested properly.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

We don't need the trailing comma in the `call`, but it's not worth a
v2 IMO. Thanks for the patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
>  arch/mips/Makefile             | 2 +-
>  arch/mips/loongson2ef/Platform | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index a00a6d94e16f..04e46ec24319 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -143,7 +143,7 @@ cflags-y += -fno-stack-check
>  #
>  # Avoid this by explicitly disabling that assembler behaviour.
>  #
> -cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
> +cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
>
>  #
>  # CPU-dependent compiler/assembler options for optimization.
> diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
> index eebabf9df6ac..c6f7a4b95997 100644
> --- a/arch/mips/loongson2ef/Platform
> +++ b/arch/mips/loongson2ef/Platform
> @@ -25,7 +25,7 @@ cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f
>  # binutils does not merge support for the flag then we can revisit & remove
>  # this later - for now it ensures vendor toolchains don't cause problems.
>  #
> -cflags-$(CONFIG_CPU_LOONGSON2EF)       += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
> +cflags-$(CONFIG_CPU_LOONGSON2EF)       += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
>
>  # Enable the workarounds for Loongson2f
>  ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
>
> --
> 2.39.0
Philippe Mathieu-Daudé Jan. 10, 2023, 7:42 a.m. UTC | #2
On 4/1/23 20:54, Nathan Chancellor wrote:
> A future change will switch as-option to use KBUILD_AFLAGS instead of
> KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
> issues if the flag being tested requires a flag previously added to
> KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
> so that the flags are tested properly.
> 
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
>   arch/mips/Makefile             | 2 +-
>   arch/mips/loongson2ef/Platform | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Thomas Bogendoerfer Jan. 10, 2023, 8:30 a.m. UTC | #3
On Wed, Jan 04, 2023 at 12:54:20PM -0700, Nathan Chancellor wrote:
> A future change will switch as-option to use KBUILD_AFLAGS instead of
> KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
> issues if the flag being tested requires a flag previously added to
> KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
> so that the flags are tested properly.
> 
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
>  arch/mips/Makefile             | 2 +-
>  arch/mips/loongson2ef/Platform | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
diff mbox series

Patch

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index a00a6d94e16f..04e46ec24319 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -143,7 +143,7 @@  cflags-y += -fno-stack-check
 #
 # Avoid this by explicitly disabling that assembler behaviour.
 #
-cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
 
 #
 # CPU-dependent compiler/assembler options for optimization.
diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
index eebabf9df6ac..c6f7a4b95997 100644
--- a/arch/mips/loongson2ef/Platform
+++ b/arch/mips/loongson2ef/Platform
@@ -25,7 +25,7 @@  cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f
 # binutils does not merge support for the flag then we can revisit & remove
 # this later - for now it ensures vendor toolchains don't cause problems.
 #
-cflags-$(CONFIG_CPU_LOONGSON2EF)	+= $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-$(CONFIG_CPU_LOONGSON2EF)	+= $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
 
 # Enable the workarounds for Loongson2f
 ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS