All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls
@ 2021-12-07 17:59 Nathan Chancellor
  2021-12-09  9:30 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2021-12-07 17:59 UTC (permalink / raw)
  To: Jiaxun Yang, Thomas Bogendoerfer
  Cc: Nick Desaulniers, linux-mips, linux-kernel, llvm,
	Nathan Chancellor, Ryutaroh Matsumoto

When building with LLVM's integrated assembler, the build errors because
it does not implement -mfix-loongson2f-{jump,nop}:

arch/mips/loongson2ef/Platform:36: *** only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop.  Stop.

The error is a little misleading because binutils are not being used in
this case.

To clear this up, remove the as-option calls because binutils 2.23 is
the minimum supported version for building the kernel. At the same time,
remove the cc-option calls for the '-march=' flags, as GCC 5.1.0 is the
minimum supported version.

This change will not fix the LLVM build for CONFIG_CPU_LOONGSON2{E,F},
as it does not implement the loongson2{e,f} march arguments (nor r4600,
so it will error prior to this change) nor the assembler flags mentioned
above but it will make the errors more obvious.

Link: https://github.com/ClangBuiltLinux/linux/issues/1529
Reported-by: Ryutaroh Matsumoto <ryutaroh@ict.e.titech.ac.jp>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---

This dependency on certain toolchain flags should probably be moved into
Kconfig at some point so that users cannot select configurations that
they do not have support for so that their builds do not error. However,
from a brief survey, there is not a clean way to codify these
dependencies at the moment because the CPU configs are selected by the
individual machines that implement them, meaning that the dependencies
would need to be added to all the machine configs (as 'select ...'
overrides 'depends on ...'), which is outside the scope of this patch.
Furthermore, one could argue that it is better for the user to get a big
error when they are missing support for something, rather than the
configs getting disabled silently, especially if they are critical to
the machine.

 arch/mips/loongson2ef/Platform | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
index ae023b9a1c51..50e659aca543 100644
--- a/arch/mips/loongson2ef/Platform
+++ b/arch/mips/loongson2ef/Platform
@@ -2,12 +2,9 @@
 # Loongson Processors' Support
 #
 
-# Only gcc >= 4.4 have Loongson specific support
 cflags-$(CONFIG_CPU_LOONGSON2EF)	+= -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON2E) += \
-	$(call cc-option,-march=loongson2e,-march=r4600)
-cflags-$(CONFIG_CPU_LOONGSON2F) += \
-	$(call cc-option,-march=loongson2f,-march=r4600)
+cflags-$(CONFIG_CPU_LOONGSON2E) += -march=loongson2e
+cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f
 #
 # Some versions of binutils, not currently mainline as of 2019/02/04, support
 # an -mfix-loongson3-llsc flag which emits a sync prior to each ll instruction
@@ -32,16 +29,8 @@ cflags-$(CONFIG_CPU_LOONGSON2EF)	+= $(call as-option,-Wa$(comma)-mno-fix-loongso
 
 # Enable the workarounds for Loongson2f
 ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
-  ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
-    $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop)
-  else
-    cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-nop
-  endif
-  ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-jump,),)
-    $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-jump)
-  else
-    cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-jump
-  endif
+cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa,-mfix-loongson2f-nop
+cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa,-mfix-loongson2f-jump
 endif
 
 # Some -march= flags enable MMI instructions, and GCC complains about that

base-commit: 0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1
-- 
2.34.1


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

* Re: [PATCH] MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls
  2021-12-07 17:59 [PATCH] MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls Nathan Chancellor
@ 2021-12-09  9:30 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2021-12-09  9:30 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Jiaxun Yang, Nick Desaulniers, linux-mips, linux-kernel, llvm,
	Ryutaroh Matsumoto

On Tue, Dec 07, 2021 at 10:59:51AM -0700, Nathan Chancellor wrote:
> When building with LLVM's integrated assembler, the build errors because
> it does not implement -mfix-loongson2f-{jump,nop}:
> 
> arch/mips/loongson2ef/Platform:36: *** only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop.  Stop.
> 
> The error is a little misleading because binutils are not being used in
> this case.
> 
> To clear this up, remove the as-option calls because binutils 2.23 is
> the minimum supported version for building the kernel. At the same time,
> remove the cc-option calls for the '-march=' flags, as GCC 5.1.0 is the
> minimum supported version.
> 
> This change will not fix the LLVM build for CONFIG_CPU_LOONGSON2{E,F},
> as it does not implement the loongson2{e,f} march arguments (nor r4600,
> so it will error prior to this change) nor the assembler flags mentioned
> above but it will make the errors more obvious.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/1529
> Reported-by: Ryutaroh Matsumoto <ryutaroh@ict.e.titech.ac.jp>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> 
> This dependency on certain toolchain flags should probably be moved into
> Kconfig at some point so that users cannot select configurations that
> they do not have support for so that their builds do not error. However,
> from a brief survey, there is not a clean way to codify these
> dependencies at the moment because the CPU configs are selected by the
> individual machines that implement them, meaning that the dependencies
> would need to be added to all the machine configs (as 'select ...'
> overrides 'depends on ...'), which is outside the scope of this patch.
> Furthermore, one could argue that it is better for the user to get a big
> error when they are missing support for something, rather than the
> configs getting disabled silently, especially if they are critical to
> the machine.
> 
>  arch/mips/loongson2ef/Platform | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2021-12-09 10:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 17:59 [PATCH] MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls Nathan Chancellor
2021-12-09  9:30 ` Thomas Bogendoerfer

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.