[Buildroot] SH4A target: error: command line option ‘-m4-nofpu’ is not supported by this configuration

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Fri Dec 2 20:31:22 UTC 2016


Hello,

On Fri, 2 Dec 2016 18:41:11 +0000, John Gulbrandsen wrote:


> I tried to manually edit ~buildroot/output/build/linux-4.7/.config :
> 
> #
> # System type
> #
> #CONFIG_CPU_SH4=y
> CONFIG_CPU_SH4A=y
> #CONFIG_CPU_SHX3=y
> 
> But this resulted in all four CPU types being put back by buildroot when doing 'make linux'.
> 
> Why does buildroot force ' CONFIG_CPU_SH4' and ' CONFIG_CPU_SHX3' to be set?

It's not Buildroot who does that, but the Linux kernel.

You have select the SH7786 processor in your Linux kernel
configuration, through the option CPU_SUBTYPE_SH7786. This option is
defined as:

config CPU_SUBTYPE_SH7786
        bool "Support SH7786 processor"
        select CPU_SH4A
        select CPU_SHX3

And then CPU_SH4A is defined as:

config CPU_SH4A
        bool
        select CPU_SH4

So, whenever you select SH7786, it is normal to have all of CPU_SHX3,
CPU_SH4 and CPU_SH4A enabled. And I believe the intent is that SH4A is
a super-set of SH4 and SHX3, which is why all of these are selected.

However, due to this, in arch/sh/Makefile, both of those lines get
enabled:

cflags-$(CONFIG_CPU_SH4)                := $(call cc-option,-m4,) \
        $(call cc-option,-mno-implicit-fp,-m4-nofpu)
cflags-$(CONFIG_CPU_SH4A)               += $(call cc-option,-m4a,) \
                                           $(call cc-option,-m4a-nofpu,)

So it means that the cc-option make function fails, because
-mno-implicit-fp is not supported, falls back to passing -m4-nofpu,
which we don't support in Buildroot when SH4A is selected at the
architecture variant.

All in all, I'm wondering if we shouldn't patch our gcc-final.mk as
follows:

diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index c9ee476..4eab3f5 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -65,12 +65,8 @@ HOST_GCC_FINAL_CONF_OPTS = \
 HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*
 # The kernel wants to use the -m4-nofpu option to make sure that it
 # doesn't use floating point operations.
-ifeq ($(BR2_sh4)$(BR2_sh4eb),y)
-HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4,m4-nofpu"
-HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib/!m4*
-endif
-ifeq ($(BR2_sh4a)$(BR2_sh4aeb),y)
-HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4a,m4a-nofpu"
+ifeq ($(BR2_sh4)$(BR2_sh4eb)$(BR2_sh4a)$(BR2_sh4aeb),y)
+HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4,m4-nofpu,m4a,m4a-nofpu"
 HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib/!m4*
 endif

Could you try this patch and see if it works?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


More information about the buildroot mailing list