All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion
@ 2022-01-20 21:40 Nathan Chancellor
  2022-01-20 21:40 ` [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option Nathan Chancellor
  2022-01-24 20:31 ` [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion Nick Desaulniers
  0 siblings, 2 replies; 10+ messages in thread
From: Nathan Chancellor @ 2022-01-20 21:40 UTC (permalink / raw)
  To: Huacai Chen, Jiaxun Yang, Thomas Bogendoerfer
  Cc: Nick Desaulniers, linux-mips, linux-kernel, llvm, Nathan Chancellor

This Makefile checks that GCC is 4.9 or newer, which is redundant after
commit 76ae847497bc ("Documentation: raise minimum supported version of
GCC to 5.1"), so cc-option can be removed.

Clang does not support -march=loongson3a so it needs to continue to use
-march=mips64r2, along with binutils less than 2.25, so check that both
GCC and binutils 2.25 or newer are being used before using
-march=loongson3a. These flags do not need to be checked with cc-option
anymore because all GCC versions support -march=loongson3a and
-march=mips64r2 and all clang versions support -march=mips64r2.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/mips/loongson64/Platform | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
index 3e660d6d3c2b..981d3abc150e 100644
--- a/arch/mips/loongson64/Platform
+++ b/arch/mips/loongson64/Platform
@@ -12,17 +12,10 @@ cflags-$(CONFIG_CPU_LOONGSON64)	+= -Wa,--trap
 # by GAS.  The cc-option can't probe for this behaviour so -march=loongson3a
 # can't easily be used safely within the kbuild framework.
 #
-ifeq ($(call cc-ifversion, -ge, 0409, y), y)
-  ifeq ($(call ld-ifversion, -ge, 22500, y), y)
-    cflags-$(CONFIG_CPU_LOONGSON64)  += \
-      $(call cc-option,-march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
-  else
-    cflags-$(CONFIG_CPU_LOONGSON64)  += \
-      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
-  endif
+ifeq ($(CONFIG_CC_IS_GCC)$(call ld-ifversion, -ge, 22500, y), yy)
+  cflags-$(CONFIG_CPU_LOONGSON64) += -march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64
 else
-    cflags-$(CONFIG_CPU_LOONGSON64)  += \
-      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
+  cflags-$(CONFIG_CPU_LOONGSON64) += -march=mips64r2
 endif
 
 # Some -march= flags enable MMI instructions, and GCC complains about that

base-commit: 2c271fe77d52a0555161926c232cd5bc07178b39
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option
  2022-01-20 21:40 [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion Nathan Chancellor
@ 2022-01-20 21:40 ` Nathan Chancellor
  2022-01-24 20:40   ` Nick Desaulniers
  2022-01-24 20:31 ` [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion Nick Desaulniers
  1 sibling, 1 reply; 10+ messages in thread
From: Nathan Chancellor @ 2022-01-20 21:40 UTC (permalink / raw)
  To: Huacai Chen, Jiaxun Yang, Thomas Bogendoerfer
  Cc: Nick Desaulniers, linux-mips, linux-kernel, llvm, Nathan Chancellor

This flag is not supported by clang, which results in a warning:

  clang-14: warning: argument unused during compilation: '-mno-branch-likely' [-Wunused-command-line-argument]

This breaks cc-option, which adds -Werror to make this warning fatal and
catch flags that are not supported. Wrap the flag in cc-option so that
it does not cause cc-option to fail, which can cause randconfigs to be
really noisy.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/mips/loongson64/Platform | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
index 981d3abc150e..acf9edc9b15d 100644
--- a/arch/mips/loongson64/Platform
+++ b/arch/mips/loongson64/Platform
@@ -26,5 +26,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
 # Loongson Machines' Support
 #
 
-cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
+cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64
+cflags-$(CONFIG_MACH_LOONGSON64) += $(call cc-option,-mno-branch-likely)
 load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion
  2022-01-20 21:40 [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion Nathan Chancellor
  2022-01-20 21:40 ` [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option Nathan Chancellor
@ 2022-01-24 20:31 ` Nick Desaulniers
  2022-01-25  0:03   ` Jiaxun Yang
  1 sibling, 1 reply; 10+ messages in thread
From: Nick Desaulniers @ 2022-01-24 20:31 UTC (permalink / raw)
  To: Nathan Chancellor, Thomas Bogendoerfer
  Cc: Huacai Chen, Jiaxun Yang, linux-mips, linux-kernel, llvm

On Thu, Jan 20, 2022 at 1:40 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> This Makefile checks that GCC is 4.9 or newer, which is redundant after
> commit 76ae847497bc ("Documentation: raise minimum supported version of
> GCC to 5.1"), so cc-option can be removed.
>
> Clang does not support -march=loongson3a so it needs to continue to use
> -march=mips64r2, along with binutils less than 2.25, so check that both
> GCC and binutils 2.25 or newer are being used before using
> -march=loongson3a. These flags do not need to be checked with cc-option
> anymore because all GCC versions support -march=loongson3a and
> -march=mips64r2 and all clang versions support -march=mips64r2.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Thanks for the patch. I wonder why `_MIPS_ISA` only seems to be set at
all for `-march=loongson3a` AFAICT, though that question is orthogonal
to this patch. Perhaps the Loongson or MIPS maintainers know more?
Otherwise seems like most uses of _MIPS_ISA can either be deleted or
simplified now.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  arch/mips/loongson64/Platform | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> index 3e660d6d3c2b..981d3abc150e 100644
> --- a/arch/mips/loongson64/Platform
> +++ b/arch/mips/loongson64/Platform
> @@ -12,17 +12,10 @@ cflags-$(CONFIG_CPU_LOONGSON64)     += -Wa,--trap
>  # by GAS.  The cc-option can't probe for this behaviour so -march=loongson3a
>  # can't easily be used safely within the kbuild framework.
>  #
> -ifeq ($(call cc-ifversion, -ge, 0409, y), y)
> -  ifeq ($(call ld-ifversion, -ge, 22500, y), y)
> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> -      $(call cc-option,-march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> -  else
> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> -  endif
> +ifeq ($(CONFIG_CC_IS_GCC)$(call ld-ifversion, -ge, 22500, y), yy)
> +  cflags-$(CONFIG_CPU_LOONGSON64) += -march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64
>  else
> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> +  cflags-$(CONFIG_CPU_LOONGSON64) += -march=mips64r2
>  endif
>
>  # Some -march= flags enable MMI instructions, and GCC complains about that
>
> base-commit: 2c271fe77d52a0555161926c232cd5bc07178b39
> --
> 2.34.1
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option
  2022-01-20 21:40 ` [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option Nathan Chancellor
@ 2022-01-24 20:40   ` Nick Desaulniers
  2022-01-24 22:37     ` Nathan Chancellor
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Desaulniers @ 2022-01-24 20:40 UTC (permalink / raw)
  To: Nathan Chancellor, Masahiro Yamada
  Cc: Huacai Chen, Jiaxun Yang, Thomas Bogendoerfer, linux-mips,
	linux-kernel, llvm

On Thu, Jan 20, 2022 at 1:40 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> This flag is not supported by clang, which results in a warning:
>
>   clang-14: warning: argument unused during compilation: '-mno-branch-likely' [-Wunused-command-line-argument]
>
> This breaks cc-option, which adds -Werror to make this warning fatal and
> catch flags that are not supported. Wrap the flag in cc-option so that
> it does not cause cc-option to fail, which can cause randconfigs to be
> really noisy.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

We should convert more of these tests to Kconfig checks that run once
per configuration, rather than multiple times for a build. IIRC Linus
mentioned this somewhere...yeah, the -Wimplicit-fallthrough patches.
See
dee2b702bcf06 ("kconfig: Add support for -Wimplicit-fallthrough")

I wonder if we can check ARCH or SUBARCH in Kconfig to limit invoking
the tool under test for certain arch specific command line flags?

I'll take this patch over such a larger change, but I think towards
the goal of speeding up already configured builds, we eventually want
to be migrating cc-option and ld-option checks to Kconfig.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  arch/mips/loongson64/Platform | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> index 981d3abc150e..acf9edc9b15d 100644
> --- a/arch/mips/loongson64/Platform
> +++ b/arch/mips/loongson64/Platform
> @@ -26,5 +26,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
>  # Loongson Machines' Support
>  #
>
> -cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
> +cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64
> +cflags-$(CONFIG_MACH_LOONGSON64) += $(call cc-option,-mno-branch-likely)
>  load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000
> --
> 2.34.1
>
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option
  2022-01-24 20:40   ` Nick Desaulniers
@ 2022-01-24 22:37     ` Nathan Chancellor
  2022-01-24 22:49       ` Nick Desaulniers
  0 siblings, 1 reply; 10+ messages in thread
From: Nathan Chancellor @ 2022-01-24 22:37 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Masahiro Yamada, Huacai Chen, Jiaxun Yang, Thomas Bogendoerfer,
	linux-mips, linux-kernel, llvm

On Mon, Jan 24, 2022 at 12:40:58PM -0800, Nick Desaulniers wrote:
> On Thu, Jan 20, 2022 at 1:40 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > This flag is not supported by clang, which results in a warning:
> >
> >   clang-14: warning: argument unused during compilation: '-mno-branch-likely' [-Wunused-command-line-argument]
> >
> > This breaks cc-option, which adds -Werror to make this warning fatal and
> > catch flags that are not supported. Wrap the flag in cc-option so that
> > it does not cause cc-option to fail, which can cause randconfigs to be
> > really noisy.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> 
> We should convert more of these tests to Kconfig checks that run once
> per configuration, rather than multiple times for a build. IIRC Linus
> mentioned this somewhere...yeah, the -Wimplicit-fallthrough patches.
> See
> dee2b702bcf06 ("kconfig: Add support for -Wimplicit-fallthrough")
> 
> I wonder if we can check ARCH or SUBARCH in Kconfig to limit invoking
> the tool under test for certain arch specific command line flags?
> 
> I'll take this patch over such a larger change, but I think towards
> the goal of speeding up already configured builds, we eventually want
> to be migrating cc-option and ld-option checks to Kconfig.
> 
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Something like this appears to work, if that is more preferrable?

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 058446f01487..a27a3ade810e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3232,3 +3232,9 @@ endmenu
 source "arch/mips/kvm/Kconfig"
 
 source "arch/mips/vdso/Kconfig"
+
+config CC_MNO_BRANCH_LIKELY
+	string
+	default "-mno-branch-likely"
+	depends on MACH_LOONGSON64 || MACH_LOONGSON2EF
+	depends on $(cc-option,-mno-branch-likely)
diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
index 50e659aca543..66ed09581417 100644
--- a/arch/mips/loongson2ef/Platform
+++ b/arch/mips/loongson2ef/Platform
@@ -41,6 +41,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
 # Loongson Machines' Support
 #
 
-cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef -mno-branch-likely
+cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef $(CONFIG_CC_MNO_BRANCH_LIKELY)
 load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
 load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
index 3e660d6d3c2b..88fbdfe9ffcc 100644
--- a/arch/mips/loongson64/Platform
+++ b/arch/mips/loongson64/Platform
@@ -33,5 +33,5 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
 # Loongson Machines' Support
 #
 
-cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
+cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 $(CONFIG_CC_MNO_BRANCH_LIKELY)
 load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000

> > ---
> >  arch/mips/loongson64/Platform | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> > index 981d3abc150e..acf9edc9b15d 100644
> > --- a/arch/mips/loongson64/Platform
> > +++ b/arch/mips/loongson64/Platform
> > @@ -26,5 +26,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
> >  # Loongson Machines' Support
> >  #
> >
> > -cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
> > +cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64
> > +cflags-$(CONFIG_MACH_LOONGSON64) += $(call cc-option,-mno-branch-likely)
> >  load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000
> > --
> > 2.34.1
> >
> >
> 
> 
> -- 
> Thanks,
> ~Nick Desaulniers

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option
  2022-01-24 22:37     ` Nathan Chancellor
@ 2022-01-24 22:49       ` Nick Desaulniers
  2022-01-24 23:09         ` Nathan Chancellor
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Desaulniers @ 2022-01-24 22:49 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Huacai Chen, Jiaxun Yang, Thomas Bogendoerfer,
	linux-mips, linux-kernel, llvm

On Mon, Jan 24, 2022 at 2:37 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Mon, Jan 24, 2022 at 12:40:58PM -0800, Nick Desaulniers wrote:
> > On Thu, Jan 20, 2022 at 1:40 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > This flag is not supported by clang, which results in a warning:
> > >
> > >   clang-14: warning: argument unused during compilation: '-mno-branch-likely' [-Wunused-command-line-argument]
> > >
> > > This breaks cc-option, which adds -Werror to make this warning fatal and
> > > catch flags that are not supported. Wrap the flag in cc-option so that
> > > it does not cause cc-option to fail, which can cause randconfigs to be
> > > really noisy.
> > >
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> >
> > We should convert more of these tests to Kconfig checks that run once
> > per configuration, rather than multiple times for a build. IIRC Linus
> > mentioned this somewhere...yeah, the -Wimplicit-fallthrough patches.
> > See
> > dee2b702bcf06 ("kconfig: Add support for -Wimplicit-fallthrough")
> >
> > I wonder if we can check ARCH or SUBARCH in Kconfig to limit invoking
> > the tool under test for certain arch specific command line flags?
> >
> > I'll take this patch over such a larger change, but I think towards
> > the goal of speeding up already configured builds, we eventually want
> > to be migrating cc-option and ld-option checks to Kconfig.
> >
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Something like this appears to work, if that is more preferrable?
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 058446f01487..a27a3ade810e 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -3232,3 +3232,9 @@ endmenu
>  source "arch/mips/kvm/Kconfig"
>
>  source "arch/mips/vdso/Kconfig"
> +
> +config CC_MNO_BRANCH_LIKELY
> +       string
> +       default "-mno-branch-likely"
> +       depends on MACH_LOONGSON64 || MACH_LOONGSON2EF
> +       depends on $(cc-option,-mno-branch-likely)
> diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
> index 50e659aca543..66ed09581417 100644
> --- a/arch/mips/loongson2ef/Platform
> +++ b/arch/mips/loongson2ef/Platform
> @@ -41,6 +41,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
>  # Loongson Machines' Support
>  #
>
> -cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef -mno-branch-likely
> +cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef $(CONFIG_CC_MNO_BRANCH_LIKELY)

Does that allow someone to modify the value for CC_MNO_BRANCH_LIKELY
in menuconfig?

If so, I'd rather the Makefiles have:

cflags-$(CONFIG_CC_MNO_BRANCH_LIKELY) += -mno-branch-likely

and CONFIG_CC_MNO_BRANCH_LIKELY be a bool rather than an editable
string.  I think that makes the Makefile more readable; you don't have
to see what CONFIG_CC_MNO_BRANCH_LIKELY expands to in a different
file.

See also CC_HAS_ASM_GOTO and CC_HAS_ASM_GOTO_OUTPUT in init/Kconfig.

>  load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
>  load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
> diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> index 3e660d6d3c2b..88fbdfe9ffcc 100644
> --- a/arch/mips/loongson64/Platform
> +++ b/arch/mips/loongson64/Platform
> @@ -33,5 +33,5 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
>  # Loongson Machines' Support
>  #
>
> -cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
> +cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 $(CONFIG_CC_MNO_BRANCH_LIKELY)
>  load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000
>
> > > ---
> > >  arch/mips/loongson64/Platform | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> > > index 981d3abc150e..acf9edc9b15d 100644
> > > --- a/arch/mips/loongson64/Platform
> > > +++ b/arch/mips/loongson64/Platform
> > > @@ -26,5 +26,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
> > >  # Loongson Machines' Support
> > >  #
> > >
> > > -cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
> > > +cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64
> > > +cflags-$(CONFIG_MACH_LOONGSON64) += $(call cc-option,-mno-branch-likely)
> > >  load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000
> > > --
> > > 2.34.1
> > >
> > >
> >
> >
> > --
> > Thanks,
> > ~Nick Desaulniers
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option
  2022-01-24 22:49       ` Nick Desaulniers
@ 2022-01-24 23:09         ` Nathan Chancellor
  0 siblings, 0 replies; 10+ messages in thread
From: Nathan Chancellor @ 2022-01-24 23:09 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Masahiro Yamada, Huacai Chen, Jiaxun Yang, Thomas Bogendoerfer,
	linux-mips, linux-kernel, llvm

On Mon, Jan 24, 2022 at 02:49:29PM -0800, Nick Desaulniers wrote:
> On Mon, Jan 24, 2022 at 2:37 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > On Mon, Jan 24, 2022 at 12:40:58PM -0800, Nick Desaulniers wrote:
> > > On Thu, Jan 20, 2022 at 1:40 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > > >
> > > > This flag is not supported by clang, which results in a warning:
> > > >
> > > >   clang-14: warning: argument unused during compilation: '-mno-branch-likely' [-Wunused-command-line-argument]
> > > >
> > > > This breaks cc-option, which adds -Werror to make this warning fatal and
> > > > catch flags that are not supported. Wrap the flag in cc-option so that
> > > > it does not cause cc-option to fail, which can cause randconfigs to be
> > > > really noisy.
> > > >
> > > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > >
> > > We should convert more of these tests to Kconfig checks that run once
> > > per configuration, rather than multiple times for a build. IIRC Linus
> > > mentioned this somewhere...yeah, the -Wimplicit-fallthrough patches.
> > > See
> > > dee2b702bcf06 ("kconfig: Add support for -Wimplicit-fallthrough")
> > >
> > > I wonder if we can check ARCH or SUBARCH in Kconfig to limit invoking
> > > the tool under test for certain arch specific command line flags?
> > >
> > > I'll take this patch over such a larger change, but I think towards
> > > the goal of speeding up already configured builds, we eventually want
> > > to be migrating cc-option and ld-option checks to Kconfig.
> > >
> > > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> >
> > Something like this appears to work, if that is more preferrable?
> >
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index 058446f01487..a27a3ade810e 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -3232,3 +3232,9 @@ endmenu
> >  source "arch/mips/kvm/Kconfig"
> >
> >  source "arch/mips/vdso/Kconfig"
> > +
> > +config CC_MNO_BRANCH_LIKELY
> > +       string
> > +       default "-mno-branch-likely"
> > +       depends on MACH_LOONGSON64 || MACH_LOONGSON2EF
> > +       depends on $(cc-option,-mno-branch-likely)
> > diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
> > index 50e659aca543..66ed09581417 100644
> > --- a/arch/mips/loongson2ef/Platform
> > +++ b/arch/mips/loongson2ef/Platform
> > @@ -41,6 +41,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
> >  # Loongson Machines' Support
> >  #
> >
> > -cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef -mno-branch-likely
> > +cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef $(CONFIG_CC_MNO_BRANCH_LIKELY)
> 
> Does that allow someone to modify the value for CC_MNO_BRANCH_LIKELY
> in menuconfig?

No because it is a hidden symbol; in other words:

config ...
    string

rather than

config ...
    string "..."

> If so, I'd rather the Makefiles have:
> 
> cflags-$(CONFIG_CC_MNO_BRANCH_LIKELY) += -mno-branch-likely
> 
> and CONFIG_CC_MNO_BRANCH_LIKELY be a bool rather than an editable
> string.  I think that makes the Makefile more readable; you don't have
> to see what CONFIG_CC_MNO_BRANCH_LIKELY expands to in a different
> file.
> 
> See also CC_HAS_ASM_GOTO and CC_HAS_ASM_GOTO_OUTPUT in init/Kconfig.

Regardless, your suggestion is simpler. I can send that as v2 if this is
preferrable.

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 058446f01487..4f83fb5610cb 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3232,3 +3232,7 @@ endmenu
 source "arch/mips/kvm/Kconfig"
 
 source "arch/mips/vdso/Kconfig"
+
+config CC_HAS_MNO_BRANCH_LIKELY
+	def_bool y
+	depends on $(cc-option,-mno-branch-likely)
diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
index 50e659aca543..eebabf9df6ac 100644
--- a/arch/mips/loongson2ef/Platform
+++ b/arch/mips/loongson2ef/Platform
@@ -41,6 +41,7 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
 # Loongson Machines' Support
 #
 
-cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef -mno-branch-likely
+cflags-$(CONFIG_MACH_LOONGSON2EF) += -I$(srctree)/arch/mips/include/asm/mach-loongson2ef
+cflags-$(CONFIG_CC_HAS_MNO_BRANCH_LIKELY) += -mno-branch-likely
 load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
 load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
index 3e660d6d3c2b..2fd9dc218a68 100644
--- a/arch/mips/loongson64/Platform
+++ b/arch/mips/loongson64/Platform
@@ -33,5 +33,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
 # Loongson Machines' Support
 #
 
-cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
+cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64
+cflags-$(CONFIG_CC_HAS_MNO_BRANCH_LIKELY) += -mno-branch-likely
 load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000

> >  load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
> >  load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
> > diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> > index 3e660d6d3c2b..88fbdfe9ffcc 100644
> > --- a/arch/mips/loongson64/Platform
> > +++ b/arch/mips/loongson64/Platform
> > @@ -33,5 +33,5 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
> >  # Loongson Machines' Support
> >  #
> >
> > -cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
> > +cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 $(CONFIG_CC_MNO_BRANCH_LIKELY)
> >  load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000
> >
> > > > ---
> > > >  arch/mips/loongson64/Platform | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> > > > index 981d3abc150e..acf9edc9b15d 100644
> > > > --- a/arch/mips/loongson64/Platform
> > > > +++ b/arch/mips/loongson64/Platform
> > > > @@ -26,5 +26,6 @@ cflags-y += $(call cc-option,-mno-loongson-mmi)
> > > >  # Loongson Machines' Support
> > > >  #
> > > >
> > > > -cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64 -mno-branch-likely
> > > > +cflags-$(CONFIG_MACH_LOONGSON64) += -I$(srctree)/arch/mips/include/asm/mach-loongson64
> > > > +cflags-$(CONFIG_MACH_LOONGSON64) += $(call cc-option,-mno-branch-likely)
> > > >  load-$(CONFIG_CPU_LOONGSON64) += 0xffffffff80200000
> > > > --
> > > > 2.34.1
> > > >
> > > >
> > >
> > >
> > > --
> > > Thanks,
> > > ~Nick Desaulniers
> >
> 
> 
> -- 
> Thanks,
> ~Nick Desaulniers

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion
  2022-01-24 20:31 ` [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion Nick Desaulniers
@ 2022-01-25  0:03   ` Jiaxun Yang
  2022-01-25  1:25     ` Nathan Chancellor
  0 siblings, 1 reply; 10+ messages in thread
From: Jiaxun Yang @ 2022-01-25  0:03 UTC (permalink / raw)
  To: Nick Desaulniers, Nathan Chancellor, Thomas Bogendoerfer
  Cc: Huacai Chen, linux-mips, linux-kernel, llvm



在2022年1月24日一月 下午8:31,Nick Desaulniers写道:
> On Thu, Jan 20, 2022 at 1:40 PM Nathan Chancellor <nathan@kernel.org> wrote:
>>
>> This Makefile checks that GCC is 4.9 or newer, which is redundant after
>> commit 76ae847497bc ("Documentation: raise minimum supported version of
>> GCC to 5.1"), so cc-option can be removed.
>>
>> Clang does not support -march=loongson3a so it needs to continue to use
>> -march=mips64r2, along with binutils less than 2.25, so check that both
>> GCC and binutils 2.25 or newer are being used before using
>> -march=loongson3a. These flags do not need to be checked with cc-option
>> anymore because all GCC versions support -march=loongson3a and
>> -march=mips64r2 and all clang versions support -march=mips64r2.
>>
>> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> Thanks for the patch. I wonder why `_MIPS_ISA` only seems to be set at
> all for `-march=loongson3a` AFAICT, though that question is orthogonal
> to this patch. Perhaps the Loongson or MIPS maintainers know more?
> Otherwise seems like most uses of _MIPS_ISA can either be deleted or
> simplified now.

This is because earlier GCC mistakenly set loongson3a to MIPS64 not MIPS64R2.

But given that it's earlier than the minimal requirement GCC of kernel today, I think it should be safe to just move the whole logic.

Thanks.

>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
>> ---
>>  arch/mips/loongson64/Platform | 13 +++----------
>>  1 file changed, 3 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
>> index 3e660d6d3c2b..981d3abc150e 100644
>> --- a/arch/mips/loongson64/Platform
>> +++ b/arch/mips/loongson64/Platform
>> @@ -12,17 +12,10 @@ cflags-$(CONFIG_CPU_LOONGSON64)     += -Wa,--trap
>>  # by GAS.  The cc-option can't probe for this behaviour so -march=loongson3a
>>  # can't easily be used safely within the kbuild framework.
>>  #
>> -ifeq ($(call cc-ifversion, -ge, 0409, y), y)
>> -  ifeq ($(call ld-ifversion, -ge, 22500, y), y)
>> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
>> -      $(call cc-option,-march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
>> -  else
>> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
>> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
>> -  endif
>> +ifeq ($(CONFIG_CC_IS_GCC)$(call ld-ifversion, -ge, 22500, y), yy)
>> +  cflags-$(CONFIG_CPU_LOONGSON64) += -march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64
>>  else
>> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
>> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
>> +  cflags-$(CONFIG_CPU_LOONGSON64) += -march=mips64r2
>>  endif
>>
>>  # Some -march= flags enable MMI instructions, and GCC complains about that
>>
>> base-commit: 2c271fe77d52a0555161926c232cd5bc07178b39
>> --
>> 2.34.1
>>
>
>
> -- 
> Thanks,
> ~Nick Desaulniers

-- 
- Jiaxun

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion
  2022-01-25  0:03   ` Jiaxun Yang
@ 2022-01-25  1:25     ` Nathan Chancellor
  2022-01-25 21:19       ` Jiaxun Yang
  0 siblings, 1 reply; 10+ messages in thread
From: Nathan Chancellor @ 2022-01-25  1:25 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: Nick Desaulniers, Thomas Bogendoerfer, Huacai Chen, linux-mips,
	linux-kernel, llvm

On Tue, Jan 25, 2022 at 12:03:32AM +0000, Jiaxun Yang wrote:
> 
> 
> 在2022年1月24日一月 下午8:31,Nick Desaulniers写道:
> > On Thu, Jan 20, 2022 at 1:40 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >>
> >> This Makefile checks that GCC is 4.9 or newer, which is redundant after
> >> commit 76ae847497bc ("Documentation: raise minimum supported version of
> >> GCC to 5.1"), so cc-option can be removed.
> >>
> >> Clang does not support -march=loongson3a so it needs to continue to use
> >> -march=mips64r2, along with binutils less than 2.25, so check that both
> >> GCC and binutils 2.25 or newer are being used before using
> >> -march=loongson3a. These flags do not need to be checked with cc-option
> >> anymore because all GCC versions support -march=loongson3a and
> >> -march=mips64r2 and all clang versions support -march=mips64r2.
> >>
> >> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> >
> > Thanks for the patch. I wonder why `_MIPS_ISA` only seems to be set at
> > all for `-march=loongson3a` AFAICT, though that question is orthogonal
> > to this patch. Perhaps the Loongson or MIPS maintainers know more?
> > Otherwise seems like most uses of _MIPS_ISA can either be deleted or
> > simplified now.
> 
> This is because earlier GCC mistakenly set loongson3a to MIPS64 not MIPS64R2.
> 
> But given that it's earlier than the minimal requirement GCC of kernel today, I think it should be safe to just move the whole logic.
> 
> Thanks.

So something like this (completely untested)?

diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
index 3e660d6d3c2b..36ab2fe00835 100644
--- a/arch/mips/loongson64/Platform
+++ b/arch/mips/loongson64/Platform
@@ -5,24 +5,9 @@
 
 cflags-$(CONFIG_CPU_LOONGSON64)	+= -Wa,--trap
 
-#
-# binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a
-# as MIPS64 R2; older versions as just R1.  This leaves the possibility open
-# that GCC might generate R2 code for -march=loongson3a which then is rejected
-# by GAS.  The cc-option can't probe for this behaviour so -march=loongson3a
-# can't easily be used safely within the kbuild framework.
-#
-ifeq ($(call cc-ifversion, -ge, 0409, y), y)
-  ifeq ($(call ld-ifversion, -ge, 22500, y), y)
-    cflags-$(CONFIG_CPU_LOONGSON64)  += \
-      $(call cc-option,-march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
-  else
-    cflags-$(CONFIG_CPU_LOONGSON64)  += \
-      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
-  endif
-else
-    cflags-$(CONFIG_CPU_LOONGSON64)  += \
-      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
+ifdef CONFIG_CPU_LOONGSON64
+cflags-$(CONFIG_CC_IS_CLANG) += -march=mips64r2
+cflags-$(CONFIG_CC_IS_GCC) += -march=loongson3a
 endif
 
 # Some -march= flags enable MMI instructions, and GCC complains about that

> >
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> >
> >> ---
> >>  arch/mips/loongson64/Platform | 13 +++----------
> >>  1 file changed, 3 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> >> index 3e660d6d3c2b..981d3abc150e 100644
> >> --- a/arch/mips/loongson64/Platform
> >> +++ b/arch/mips/loongson64/Platform
> >> @@ -12,17 +12,10 @@ cflags-$(CONFIG_CPU_LOONGSON64)     += -Wa,--trap
> >>  # by GAS.  The cc-option can't probe for this behaviour so -march=loongson3a
> >>  # can't easily be used safely within the kbuild framework.
> >>  #
> >> -ifeq ($(call cc-ifversion, -ge, 0409, y), y)
> >> -  ifeq ($(call ld-ifversion, -ge, 22500, y), y)
> >> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> >> -      $(call cc-option,-march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> >> -  else
> >> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> >> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> >> -  endif
> >> +ifeq ($(CONFIG_CC_IS_GCC)$(call ld-ifversion, -ge, 22500, y), yy)
> >> +  cflags-$(CONFIG_CPU_LOONGSON64) += -march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64
> >>  else
> >> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> >> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> >> +  cflags-$(CONFIG_CPU_LOONGSON64) += -march=mips64r2
> >>  endif
> >>
> >>  # Some -march= flags enable MMI instructions, and GCC complains about that
> >>
> >> base-commit: 2c271fe77d52a0555161926c232cd5bc07178b39
> >> --
> >> 2.34.1
> >>
> >
> >
> > -- 
> > Thanks,
> > ~Nick Desaulniers
> 
> -- 
> - Jiaxun

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion
  2022-01-25  1:25     ` Nathan Chancellor
@ 2022-01-25 21:19       ` Jiaxun Yang
  0 siblings, 0 replies; 10+ messages in thread
From: Jiaxun Yang @ 2022-01-25 21:19 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nick Desaulniers, Thomas Bogendoerfer, Huacai Chen, linux-mips,
	linux-kernel, llvm



在2022年1月25日一月 上午1:25,Nathan Chancellor写道:
[...]
>
> So something like this (completely untested)?

Yep, tested with multiple GCC toolchains and it works :-)

Thanks.

>
> diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
> index 3e660d6d3c2b..36ab2fe00835 100644
> --- a/arch/mips/loongson64/Platform
> +++ b/arch/mips/loongson64/Platform
> @@ -5,24 +5,9 @@
> 
>  cflags-$(CONFIG_CPU_LOONGSON64)	+= -Wa,--trap
> 
> -#
> -# binutils from v2.25 on and gcc starting from v4.9.0 treat 
> -march=loongson3a
> -# as MIPS64 R2; older versions as just R1.  This leaves the 
> possibility open
> -# that GCC might generate R2 code for -march=loongson3a which then is 
> rejected
> -# by GAS.  The cc-option can't probe for this behaviour so 
> -march=loongson3a
> -# can't easily be used safely within the kbuild framework.
> -#
> -ifeq ($(call cc-ifversion, -ge, 0409, y), y)
> -  ifeq ($(call ld-ifversion, -ge, 22500, y), y)
> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> -      $(call cc-option,-march=loongson3a -U_MIPS_ISA 
> -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> -  else
> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA 
> -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> -  endif
> -else
> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA 
> -D_MIPS_ISA=_MIPS_ISA_MIPS64)
> +ifdef CONFIG_CPU_LOONGSON64
> +cflags-$(CONFIG_CC_IS_CLANG) += -march=mips64r2
> +cflags-$(CONFIG_CC_IS_GCC) += -march=loongson3a
>  endif
> 
>  # Some -march= flags enable MMI instructions, and GCC complains about that
>
>> >
>> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>> >
>> >> ---
>> >>  arch/mips/loongson64/Platform | 13 +++----------
>> >>  1 file changed, 3 insertions(+), 10 deletions(-)
>> >>
>> >> diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform
>> >> index 3e660d6d3c2b..981d3abc150e 100644
>> >> --- a/arch/mips/loongson64/Platform
>> >> +++ b/arch/mips/loongson64/Platform
>> >> @@ -12,17 +12,10 @@ cflags-$(CONFIG_CPU_LOONGSON64)     += -Wa,--trap
>> >>  # by GAS.  The cc-option can't probe for this behaviour so -march=loongson3a
>> >>  # can't easily be used safely within the kbuild framework.
>> >>  #
>> >> -ifeq ($(call cc-ifversion, -ge, 0409, y), y)
>> >> -  ifeq ($(call ld-ifversion, -ge, 22500, y), y)
>> >> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
>> >> -      $(call cc-option,-march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
>> >> -  else
>> >> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
>> >> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
>> >> -  endif
>> >> +ifeq ($(CONFIG_CC_IS_GCC)$(call ld-ifversion, -ge, 22500, y), yy)
>> >> +  cflags-$(CONFIG_CPU_LOONGSON64) += -march=loongson3a -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64
>> >>  else
>> >> -    cflags-$(CONFIG_CPU_LOONGSON64)  += \
>> >> -      $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
>> >> +  cflags-$(CONFIG_CPU_LOONGSON64) += -march=mips64r2
>> >>  endif
>> >>
>> >>  # Some -march= flags enable MMI instructions, and GCC complains about that
>> >>
>> >> base-commit: 2c271fe77d52a0555161926c232cd5bc07178b39
>> >> --
>> >> 2.34.1
>> >>
>> >
>> >
>> > -- 
>> > Thanks,
>> > ~Nick Desaulniers
>> 
>> -- 
>> - Jiaxun

-- 
- Jiaxun

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-25 21:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 21:40 [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion Nathan Chancellor
2022-01-20 21:40 ` [PATCH 2/2] MIPS: Loongson64: Wrap -mno-branch-likely with cc-option Nathan Chancellor
2022-01-24 20:40   ` Nick Desaulniers
2022-01-24 22:37     ` Nathan Chancellor
2022-01-24 22:49       ` Nick Desaulniers
2022-01-24 23:09         ` Nathan Chancellor
2022-01-24 20:31 ` [PATCH 1/2] MIPS: Loongson64: Clean up use of cc-ifversion Nick Desaulniers
2022-01-25  0:03   ` Jiaxun Yang
2022-01-25  1:25     ` Nathan Chancellor
2022-01-25 21:19       ` Jiaxun Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.