Skip to content

Commit

Permalink
[arch][arm] avoid using -mgeneral-regs-only for arm32
Browse files Browse the repository at this point in the history
For older compilers (gcc 7.5.0 in particular) avoid using
-mgeneral-regs-only to override the floating point switches, since it
doesn't seem to understand that switch.

Instead more properly add the floating point switches for a module or
source file compiled with float. More compatible with all compilers.
  • Loading branch information
travisg committed May 14, 2024
1 parent 1a761ab commit 0357394
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 6 additions & 4 deletions arch/arm/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,14 @@ MODULE_SRCS += \
$(LOCAL_DIR)/arm/cache.c \
$(LOCAL_DIR)/arm/debug.c \
$(LOCAL_DIR)/arm/ops.S \
$(LOCAL_DIR)/arm/exceptions.S \
$(LOCAL_DIR)/arm/faults.c \
$(LOCAL_DIR)/arm/fpu.c \
$(LOCAL_DIR)/arm/mmu.c \
$(LOCAL_DIR)/arm/thread.c

MODULE_FLOAT_SRCS += \
$(LOCAL_DIR)/arm/exceptions.S \
$(LOCAL_DIR)/arm/fpu.c \

MODULE_ARM_OVERRIDE_SRCS := \
$(LOCAL_DIR)/arm/arch.c

Expand Down Expand Up @@ -333,8 +335,8 @@ TOOLCHAIN_PREFIX := $(ARCH_$(ARCH)_TOOLCHAIN_PREFIX)
$(info TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX))

ARCH_COMPILEFLAGS += $(ARCH_$(ARCH)_COMPILEFLAGS)
ARCH_COMPILEFLAGS_NOFLOAT := -mgeneral-regs-only
ARCH_COMPILEFLAGS_FLOAT :=
ARCH_COMPILEFLAGS_NOFLOAT :=
ARCH_COMPILEFLAGS_FLOAT := $(ARCH_$(ARCH)_COMPILEFLAGS_FLOAT)

GLOBAL_COMPILEFLAGS += $(THUMBINTERWORK)

Expand Down
20 changes: 9 additions & 11 deletions arch/arm/toolchain.mk
Original file line number Diff line number Diff line change
Expand Up @@ -75,33 +75,31 @@ ARCH_arm_COMPILEFLAGS += -mcpu=cortex-m4
endif
ifeq ($(ARM_CPU),cortex-m7-fpu-sp-d16)
# use cortex-m4 for now until better general toolchain support
ARCH_arm_COMPILEFLAGS += -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
ARCH_arm_COMPILEFLAGS += -mcpu=cortex-m4
ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
endif
ifeq ($(ARM_CPU),cortex-m4f)
ARCH_arm_COMPILEFLAGS += -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
ARCH_arm_COMPILEFLAGS += -mcpu=cortex-m4
ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
endif
ifeq ($(ARM_CPU),cortex-a7)
ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU)
ARCH_arm_COMPILEFLAGS += -mfpu=vfpv3 -mfloat-abi=softfp
ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=vfpv3 -mfloat-abi=softfp
endif
ifeq ($(ARM_CPU),cortex-a8)
ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU)
ARCH_arm_COMPILEFLAGS += -mfpu=neon -mfloat-abi=softfp
ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=neon -mfloat-abi=softfp
endif
ifeq ($(ARM_CPU),cortex-a9)
ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU)
endif
ifeq ($(ARM_CPU),cortex-a9-neon)
ARCH_arm_COMPILEFLAGS += -mcpu=cortex-a9
# XXX cannot enable neon right now because compiler generates
# neon code for 64bit integer ops
ARCH_arm_COMPILEFLAGS += -mfpu=vfpv3 -mfloat-abi=softfp
ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=neon -mfloat-abi=softfp
endif
ifeq ($(ARM_CPU),cortex-a15)
ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU)
ifneq ($(ARM_WITHOUT_VFP_NEON),true)
ARCH_arm_COMPILEFLAGS += -mfpu=vfpv3 -mfloat-abi=softfp
endif
ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=neon -mfloat-abi=softfp
endif
ifeq ($(ARM_CPU),arm1136j-s)
ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU)
Expand All @@ -113,7 +111,7 @@ ifeq ($(ARM_CPU),cortex-r4f)
ARCH_arm_COMPILEFLAGS += -march=armv7-r
ARCH_arm_COMPILEFLAGS += -mcpu=$(ARM_CPU)
ARCH_arm_COMPILEFLAGS += -mbig-endian
ARCH_arm_COMPILEFLAGS += -mfpu=vfpv3-d16 -mfloat-abi=hard
ARCH_arm_COMPILEFLAGS_FLOAT += -mfpu=vfpv3-d16 -mfloat-abi=hard
GLOBAL_MODULE_LDFLAGS += -EB
endif
ifeq ($(ARM_CPU),armemu)
Expand Down

0 comments on commit 0357394

Please sign in to comment.