From 7af151aa5189df084fc906edebbd4286c255cfb4 Mon Sep 17 00:00:00 2001 From: Alexander Lunev Date: Thu, 29 Jun 2023 01:36:46 +0800 Subject: [PATCH] arch/arm: move -mthumb option back to ARCHCPUFLAGS CONFIG_ARM_TOOLCHAIN_GNU_EABI build got broken when -mthumb option was moved from ARCHCPUFLAGS to ARCHOPTIMIZATION variable: arm-none-eabi-ld: error: .../build/nuttx/nuttx uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_fixunsdfdi.o) does not arm-none-eabi-ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_fixunsdfdi.o) arm-none-eabi-ld: error: .../build/nuttx/nuttx uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_udivmoddi4.o) does not arm-none-eabi-ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_udivmoddi4.o) --- arch/arm/src/common/Toolchain.defs | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs index 44f9bcd301..2607474487 100644 --- a/arch/arm/src/common/Toolchain.defs +++ b/arch/arm/src/common/Toolchain.defs @@ -74,23 +74,6 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y) ARCHOPTIMIZATION += -fsanitize=kernel-address endif -ifeq ($(CONFIG_ARM_THUMB),y) - ARCHOPTIMIZATION += -mthumb - - # GCC Manual: - # -mthumb - # ... If you want to force assembler files to be interpreted as Thumb - # code, either add a `.thumb' directive to the source or pass the - # -mthumb option directly to the assembler by prefixing it with -Wa. - - ARCHOPTIMIZATION += -Wa,-mthumb - - # Outputs an implicit IT block when there is a conditional instruction - # without an enclosing IT block. - - ARCHOPTIMIZATION += -Wa,-mimplicit-it=always -endif - ifeq ($(CONFIG_UNWINDER_ARM),y) ARCHOPTIMIZATION += -funwind-tables -fasynchronous-unwind-tables endif @@ -144,6 +127,23 @@ endif ARCHCPUFLAGS += $(TOOLCHAIN_MARCH) $(TOOLCHAIN_MTUNE) $(TOOLCHAIN_MFLOAT) +ifeq ($(CONFIG_ARM_THUMB),y) + ARCHCPUFLAGS += -mthumb + + # GCC Manual: + # -mthumb + # ... If you want to force assembler files to be interpreted as Thumb + # code, either add a `.thumb' directive to the source or pass the + # -mthumb option directly to the assembler by prefixing it with -Wa. + + ARCHCPUFLAGS += -Wa,-mthumb + + # Outputs an implicit IT block when there is a conditional instruction + # without an enclosing IT block. + + ARCHCPUFLAGS += -Wa,-mimplicit-it=always +endif + # Clang toolchain ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)