Skip to content

Commit 5ab6b81

Browse files
juerghRobertCNelson
authored andcommitted
ARM: Fix instruction set selection for GCC 11
GCC 11 on ARM now complains like the following when trying to determine if an arch is supported. Presumably because it enforces the default option '--with-float=hard' which GCC 10 didn't do? $ arm-linux-gnueabihf-gcc-11 -march=armv7-a -c -x c /dev/null cc1: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU Due to that, the kernel build system selects the wrong compiler options which throws errros like this during the build: /tmp/ccrHfZPj.s: Assembler messages: /tmp/ccrHfZPj.s:116: Error: selected processor does not support `dmb ish' in ARM mode /tmp/ccrHfZPj.s:150: Error: selected processor does not support `isb ' in ARM mode /tmp/ccrHfZPj.s:160: Error: selected processor does not support `mrrc p15,1,r4,r5,c14' in ARM mode /tmp/ccrHfZPj.s:245: Error: selected processor does not support `dmb ish' in ARM mode /tmp/ccrHfZPj.s:503: Error: selected processor does not support `dmb ish' in ARM mode /tmp/ccrHfZPj.s:527: Error: selected processor does not support `dmb ish' in ARM mode /tmp/ccrHfZPj.s:698: Error: selected processor does not support `dmb ish' in ARM mode /tmp/ccrHfZPj.s:731: Error: selected processor does not support `isb ' in ARM mode Fix that by adding '-msoft-float' to KBUILD_CFLAGS before the definition of the 'arch-$(CONFIG_CPU_<foo>)' instruction selection macros. Signed-off-by: Juerg Haefliger <[email protected]>
1 parent e750d0d commit 5ab6b81

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/arm/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ endif
5959
#
6060
KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra)
6161

62+
# Need -msoft-float for gcc 11 for the below instruction set selection
63+
KBUILD_CFLAGS += -msoft-float
64+
6265
# This selects which instruction set is used.
6366
# Note that GCC does not numerically define an architecture version
6467
# macro, but instead defines a whole series of macros which makes
@@ -129,7 +132,7 @@ AFLAGS_ISA :=$(CFLAGS_ISA)
129132
endif
130133

131134
# Need -Uarm for gcc < 3.x
132-
KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
135+
KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -Uarm
133136
KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
134137

135138
CHECKFLAGS += -D__arm__

0 commit comments

Comments
 (0)