linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: pass -msoft-float to gcc earlier
@ 2020-05-27 13:49 Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2020-05-27 13:49 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Szabolcs Nagy, Masahiro Yamada, Will Deacon,
	Nathan Chancellor, Nathan Huckleberry, linux-arm-kernel,
	linux-kernel

Szabolcs Nagy ran into a kernel build failure with a custom gcc
toochain that sets -mfpu=auto -mfloat-abi-hard:

 /tmp/ccmNdcdf.s:1898: Error: selected processor does not support `cpsid i' in ARM mode

The problem is that $(call cc-option, -march=armv7-a) fails before the
kernel overrides the gcc options to also pass -msoft-float.

Move the option to the beginning the Makefile, before we call
cc-option for the first time.

Reported-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87302
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index fcd40c5bfd94..9804f8f61e67 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -16,6 +16,8 @@ LDFLAGS_vmlinux	+= --be8
 KBUILD_LDFLAGS_MODULE	+= --be8
 endif
 
+KBUILD_CFLAGS	+= -msoft-float
+
 ifeq ($(CONFIG_CPU_32v4),y)
 LDFLAGS_vmlinux	+= $(call ld-option,--fix-v4bx)
 LDFLAGS_MODULE	+= $(call ld-option,--fix-v4bx)
@@ -138,7 +140,7 @@ AFLAGS_ISA	:=$(CFLAGS_ISA)
 endif
 
 # Need -Uarm for gcc < 3.x
-KBUILD_CFLAGS	+=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
+KBUILD_CFLAGS	+=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
 KBUILD_AFLAGS	+=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
 
 CHECKFLAGS	+= -D__arm__
-- 
2.26.2


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

* Re: [PATCH] ARM: pass -msoft-float to gcc earlier
  2020-05-20  8:36     ` Szabolcs Nagy
@ 2020-05-20 16:19       ` Nick Desaulniers
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Desaulniers @ 2020-05-20 16:19 UTC (permalink / raw)
  To: Szabolcs Nagy, Arnd Bergmann
  Cc: Russell King, Masahiro Yamada, Linus Walleij, Linux ARM, LKML, nd

On Wed, May 20, 2020 at 1:36 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
>
> The 05/19/2020 17:38, Nick Desaulniers wrote:
> > sorry, hit tab/enter too soon...
> >
> > On Tue, May 19, 2020 at 5:37 PM Nick Desaulniers
> > <ndesaulniers@google.com> wrote:
> > >
> > > On Tue, May 19, 2020 at 3:09 PM Arnd Bergmann <arnd@arndb.de> wrote:
> > > >
> > > > Szabolcs Nagy ran into a kernel build failure with a custom gcc
> > > > toochain that sets -mfpu=auto -mfloat-abi=hard:
> > > >
> > > >  /tmp/ccmNdcdf.s:1898: Error: selected processor does not support `cpsid i' in ARM mode
> > > >
> > > > The problem is that $(call cc-option, -march=armv7-a) fails before the
> > > > kernel overrides the gcc options to also pass -msoft-float.
> > >
> > > The call to `$(call cc-option, -march=armv7-a) is th
> >
> > The call to `$(call cc-option, -march=armv7-a) is the one that fails or...?
>
> the flag -march=armv7-a is invalid if the float abi
> is hard and no fpu is specified (since gcc-8).
>
> either an fpu should be specified or -march=armv7-a+fp
> (my toolchain was configured with the latter and it does
> not work if the kernel overrides it with -march=armv7-a)
>
> because of this cc-option failure the kernel goes on to
> pass nonsense flags everywhere (-march=armv5t) and some
> compilation eventually fails with an asm error.

Cool, thanks for the additional info.  Arnd, if you wanted to include
more of that snippet the commit message when submitting, I wouldn't
complain. :)
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
> > > >
> > > > Move the option to the beginning the Makefile, before we call
> > >
> > > beginning of the
> > >
> > > > cc-option for the first time.
> > > >
> > > > Reported-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
> > > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87302
> > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > >
> > > Moving this looks harmless enough, though it's not clear to me how the
> > > failure you're describing would occur.  I don't see calls to as-instr
> > > in arch/arm/Makefile.  Which object is being built before -msoft-float
> > > is being set?
> >
> > ... ^
> >
> > >
> > > > ---
> > > >  arch/arm/Makefile | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> > > > index 7d5cd0f85461..e428ea6eb0fa 100644
> > > > --- a/arch/arm/Makefile
> > > > +++ b/arch/arm/Makefile
> > > > @@ -16,6 +16,8 @@ LDFLAGS_vmlinux       += --be8
> > > >  KBUILD_LDFLAGS_MODULE  += --be8
> > > >  endif
> > > >
> > > > +KBUILD_CFLAGS  += -msoft-float
> > > > +
> > > >  ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
> > > >  KBUILD_LDS_MODULE      += $(srctree)/arch/arm/kernel/module.lds
> > > >  endif
> > > > @@ -135,7 +137,7 @@ AFLAGS_ISA  :=$(CFLAGS_ISA)
> > > >  endif
> > > >
> > > >  # Need -Uarm for gcc < 3.x
> > > > -KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
> > > > +KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
> > > >  KBUILD_AFLAGS  +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
> > > >
> > > >  CHECKFLAGS     += -D__arm__
> > > > --
> > > > 2.26.2
> > > >
> >
> > --
> > Thanks,
> > ~Nick Desaulniers
>
> --



-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] ARM: pass -msoft-float to gcc earlier
  2020-05-20  0:38   ` Nick Desaulniers
@ 2020-05-20  8:36     ` Szabolcs Nagy
  2020-05-20 16:19       ` Nick Desaulniers
  0 siblings, 1 reply; 6+ messages in thread
From: Szabolcs Nagy @ 2020-05-20  8:36 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Arnd Bergmann, Russell King, Masahiro Yamada, Linus Walleij,
	Linux ARM, LKML, nd

The 05/19/2020 17:38, Nick Desaulniers wrote:
> sorry, hit tab/enter too soon...
> 
> On Tue, May 19, 2020 at 5:37 PM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > On Tue, May 19, 2020 at 3:09 PM Arnd Bergmann <arnd@arndb.de> wrote:
> > >
> > > Szabolcs Nagy ran into a kernel build failure with a custom gcc
> > > toochain that sets -mfpu=auto -mfloat-abi=hard:
> > >
> > >  /tmp/ccmNdcdf.s:1898: Error: selected processor does not support `cpsid i' in ARM mode
> > >
> > > The problem is that $(call cc-option, -march=armv7-a) fails before the
> > > kernel overrides the gcc options to also pass -msoft-float.
> >
> > The call to `$(call cc-option, -march=armv7-a) is th
> 
> The call to `$(call cc-option, -march=armv7-a) is the one that fails or...?

the flag -march=armv7-a is invalid if the float abi
is hard and no fpu is specified (since gcc-8).

either an fpu should be specified or -march=armv7-a+fp
(my toolchain was configured with the latter and it does
not work if the kernel overrides it with -march=armv7-a)

because of this cc-option failure the kernel goes on to
pass nonsense flags everywhere (-march=armv5t) and some
compilation eventually fails with an asm error.

> > >
> > > Move the option to the beginning the Makefile, before we call
> >
> > beginning of the
> >
> > > cc-option for the first time.
> > >
> > > Reported-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
> > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87302
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >
> > Moving this looks harmless enough, though it's not clear to me how the
> > failure you're describing would occur.  I don't see calls to as-instr
> > in arch/arm/Makefile.  Which object is being built before -msoft-float
> > is being set?
> 
> ... ^
> 
> >
> > > ---
> > >  arch/arm/Makefile | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> > > index 7d5cd0f85461..e428ea6eb0fa 100644
> > > --- a/arch/arm/Makefile
> > > +++ b/arch/arm/Makefile
> > > @@ -16,6 +16,8 @@ LDFLAGS_vmlinux       += --be8
> > >  KBUILD_LDFLAGS_MODULE  += --be8
> > >  endif
> > >
> > > +KBUILD_CFLAGS  += -msoft-float
> > > +
> > >  ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
> > >  KBUILD_LDS_MODULE      += $(srctree)/arch/arm/kernel/module.lds
> > >  endif
> > > @@ -135,7 +137,7 @@ AFLAGS_ISA  :=$(CFLAGS_ISA)
> > >  endif
> > >
> > >  # Need -Uarm for gcc < 3.x
> > > -KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
> > > +KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
> > >  KBUILD_AFLAGS  +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
> > >
> > >  CHECKFLAGS     += -D__arm__
> > > --
> > > 2.26.2
> > >
> 
> -- 
> Thanks,
> ~Nick Desaulniers

-- 

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

* Re: [PATCH] ARM: pass -msoft-float to gcc earlier
  2020-05-20  0:37 ` Nick Desaulniers
@ 2020-05-20  0:38   ` Nick Desaulniers
  2020-05-20  8:36     ` Szabolcs Nagy
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Desaulniers @ 2020-05-20  0:38 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Russell King, Szabolcs Nagy, Masahiro Yamada, Linus Walleij,
	Linux ARM, LKML

sorry, hit tab/enter too soon...

On Tue, May 19, 2020 at 5:37 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Tue, May 19, 2020 at 3:09 PM Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > Szabolcs Nagy ran into a kernel build failure with a custom gcc
> > toochain that sets -mfpu=auto -mfloat-abi=hard:
> >
> >  /tmp/ccmNdcdf.s:1898: Error: selected processor does not support `cpsid i' in ARM mode
> >
> > The problem is that $(call cc-option, -march=armv7-a) fails before the
> > kernel overrides the gcc options to also pass -msoft-float.
>
> The call to `$(call cc-option, -march=armv7-a) is th

The call to `$(call cc-option, -march=armv7-a) is the one that fails or...?

>
> >
> > Move the option to the beginning the Makefile, before we call
>
> beginning of the
>
> > cc-option for the first time.
> >
> > Reported-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
> > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87302
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Moving this looks harmless enough, though it's not clear to me how the
> failure you're describing would occur.  I don't see calls to as-instr
> in arch/arm/Makefile.  Which object is being built before -msoft-float
> is being set?

... ^

>
> > ---
> >  arch/arm/Makefile | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> > index 7d5cd0f85461..e428ea6eb0fa 100644
> > --- a/arch/arm/Makefile
> > +++ b/arch/arm/Makefile
> > @@ -16,6 +16,8 @@ LDFLAGS_vmlinux       += --be8
> >  KBUILD_LDFLAGS_MODULE  += --be8
> >  endif
> >
> > +KBUILD_CFLAGS  += -msoft-float
> > +
> >  ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
> >  KBUILD_LDS_MODULE      += $(srctree)/arch/arm/kernel/module.lds
> >  endif
> > @@ -135,7 +137,7 @@ AFLAGS_ISA  :=$(CFLAGS_ISA)
> >  endif
> >
> >  # Need -Uarm for gcc < 3.x
> > -KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
> > +KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
> >  KBUILD_AFLAGS  +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
> >
> >  CHECKFLAGS     += -D__arm__
> > --
> > 2.26.2
> >

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] ARM: pass -msoft-float to gcc earlier
  2020-05-19 22:08 Arnd Bergmann
@ 2020-05-20  0:37 ` Nick Desaulniers
  2020-05-20  0:38   ` Nick Desaulniers
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Desaulniers @ 2020-05-20  0:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Russell King, Szabolcs Nagy, Masahiro Yamada, Linus Walleij,
	Linux ARM, LKML

On Tue, May 19, 2020 at 3:09 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> Szabolcs Nagy ran into a kernel build failure with a custom gcc
> toochain that sets -mfpu=auto -mfloat-abi=hard:
>
>  /tmp/ccmNdcdf.s:1898: Error: selected processor does not support `cpsid i' in ARM mode
>
> The problem is that $(call cc-option, -march=armv7-a) fails before the
> kernel overrides the gcc options to also pass -msoft-float.

The call to `$(call cc-option, -march=armv7-a)

>
> Move the option to the beginning the Makefile, before we call

beginning of the

> cc-option for the first time.
>
> Reported-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87302
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Moving this looks harmless enough, though it's not clear to me how the
failure you're describing would occur.  I don't see calls to as-instr
in arch/arm/Makefile.  Which object is being built before -msoft-float
is being set?

> ---
>  arch/arm/Makefile | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 7d5cd0f85461..e428ea6eb0fa 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -16,6 +16,8 @@ LDFLAGS_vmlinux       += --be8
>  KBUILD_LDFLAGS_MODULE  += --be8
>  endif
>
> +KBUILD_CFLAGS  += -msoft-float
> +
>  ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
>  KBUILD_LDS_MODULE      += $(srctree)/arch/arm/kernel/module.lds
>  endif
> @@ -135,7 +137,7 @@ AFLAGS_ISA  :=$(CFLAGS_ISA)
>  endif
>
>  # Need -Uarm for gcc < 3.x
> -KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
> +KBUILD_CFLAGS  +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
>  KBUILD_AFLAGS  +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
>
>  CHECKFLAGS     += -D__arm__
> --
> 2.26.2
>


-- 
Thanks,
~Nick Desaulniers

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

* [PATCH] ARM: pass -msoft-float to gcc earlier
@ 2020-05-19 22:08 Arnd Bergmann
  2020-05-20  0:37 ` Nick Desaulniers
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2020-05-19 22:08 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Szabolcs Nagy, Masahiro Yamada, Nick Desaulniers,
	Linus Walleij, linux-arm-kernel, linux-kernel

Szabolcs Nagy ran into a kernel build failure with a custom gcc
toochain that sets -mfpu=auto -mfloat-abi=hard:

 /tmp/ccmNdcdf.s:1898: Error: selected processor does not support `cpsid i' in ARM mode

The problem is that $(call cc-option, -march=armv7-a) fails before the
kernel overrides the gcc options to also pass -msoft-float.

Move the option to the beginning the Makefile, before we call
cc-option for the first time.

Reported-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87302
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 7d5cd0f85461..e428ea6eb0fa 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -16,6 +16,8 @@ LDFLAGS_vmlinux	+= --be8
 KBUILD_LDFLAGS_MODULE	+= --be8
 endif
 
+KBUILD_CFLAGS	+= -msoft-float
+
 ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
 KBUILD_LDS_MODULE	+= $(srctree)/arch/arm/kernel/module.lds
 endif
@@ -135,7 +137,7 @@ AFLAGS_ISA	:=$(CFLAGS_ISA)
 endif
 
 # Need -Uarm for gcc < 3.x
-KBUILD_CFLAGS	+=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
+KBUILD_CFLAGS	+=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
 KBUILD_AFLAGS	+=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
 
 CHECKFLAGS	+= -D__arm__
-- 
2.26.2


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

end of thread, other threads:[~2020-05-27 13:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 13:49 [PATCH] ARM: pass -msoft-float to gcc earlier Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2020-05-19 22:08 Arnd Bergmann
2020-05-20  0:37 ` Nick Desaulniers
2020-05-20  0:38   ` Nick Desaulniers
2020-05-20  8:36     ` Szabolcs Nagy
2020-05-20 16:19       ` Nick Desaulniers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).