Skip to contentSkip to conversation

ARM: pass -msoft-float to gcc earlier

PATCH In review Arnd Bergmann 3 participants 5 messages May 19, 2020 – May 20, 2020 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: pass -msoft-float to gcc earlier

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.

---
 arch/arm/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/Makefile +3 -1
index 7d5cd0f85461..e428ea6eb0fa 100644
@@ -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__
Signature · 1 line
2.26.2
#1 lore raw
Quoted 8 lines · Arnd Bergmann

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)

Quoted 2 lines

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

beginning of the

Quoted 5 lines

cc-option for the first time.

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?

Quoted 29 lines
---
 arch/arm/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/Makefile +3 -2
index 7d5cd0f85461..e428ea6eb0fa 100644
@@ -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

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw

sorry, hit tab/enter too soon...

Quoted 6 lines · Nick Desaulniers
Quoted 4 lines · Arnd Bergmann

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

Quoted 6 lines
Quoted 4 lines

/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...?

Quoted 8 lines
Quoted 3 lines

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

beginning of the

Quoted 2 lines

cc-option for the first time.

Quoted 8 lines
Quoted 3 lines

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?

... ^

Quoted 30 lines
Quoted 30 lines
---
 arch/arm/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/Makefile +3 -2
index 7d5cd0f85461..e428ea6eb0fa 100644
@@ -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

Signature · 2 lines
Thanks,
~Nick Desaulniers
#3 lore raw
Quoted 10 lines · Nick Desaulniers

sorry, hit tab/enter too soon...

Quoted 6 lines · Nick Desaulniers
Quoted 4 lines · Arnd Bergmann

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

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

/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.

Quoted 52 lines
Quoted 7 lines
Quoted 2 lines

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

beginning of the

Quoted 2 lines

cc-option for the first time.

Quoted 8 lines
Quoted 3 lines

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?

... ^

Quoted 30 lines
Quoted 30 lines
---
 arch/arm/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/Makefile +3 -2
index 7d5cd0f85461..e428ea6eb0fa 100644
@@ -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

Signature · 2 lines
Thanks,
~Nick Desaulniers
Signature · 4 lines
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by
#4 lore raw
Quoted 24 lines · Szabolcs Nagy
Quoted 10 lines · Nick Desaulniers

sorry, hit tab/enter too soon...

Quoted 6 lines · Nick Desaulniers
Quoted 4 lines · Arnd Bergmann

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

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

/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).

Quoted 7 lines

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. :)

Quoted 55 lines
Quoted 45 lines
Quoted 8 lines
Quoted 3 lines

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

beginning of the

Quoted 2 lines

cc-option for the first time.

Quoted 8 lines
Quoted 3 lines

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?

... ^

Quoted 26 lines
Quoted 26 lines
---
 arch/arm/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/Makefile +3 -1
index 7d5cd0f85461..e428ea6eb0fa 100644
@@ -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
 
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/Makefile +0 -1
 CHECKFLAGS     += -D__arm__
--

2.26.2

--
Thanks,
~Nick Desaulniers

--

Signature · 2 lines
Thanks,
~Nick Desaulniers