mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-07 21:33:54 +00:00
refactor(build): merge march32/64 directives
Both march32-directive and march64-directive eventually generate the same march option that will passed to compiler. Merge this two separate directives to a common one as march-directive. Change-Id: I220d2b782eb3b54e13ffd5b6a581d0e6da68756a Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
This commit is contained in:
parent
e09b8aa5a5
commit
d4089fb8d8
4 changed files with 22 additions and 29 deletions
37
Makefile
37
Makefile
|
@ -217,18 +217,16 @@ endif #(FEAT_RME)
|
|||
################################################################################
|
||||
ifeq (${ARM_ARCH_MAJOR},7)
|
||||
target32-directive = -target arm-none-eabi
|
||||
# Will set march32-directive from platform configuration
|
||||
# Will set march-directive from platform configuration
|
||||
else
|
||||
target32-directive = -target armv8a-none-eabi
|
||||
|
||||
# Set the compiler's target architecture profile based on
|
||||
# ARM_ARCH_MAJOR ARM_ARCH_MINOR options
|
||||
ifeq (${ARM_ARCH_MINOR},0)
|
||||
march32-directive = -march=armv${ARM_ARCH_MAJOR}-a
|
||||
march64-directive = -march=armv${ARM_ARCH_MAJOR}-a
|
||||
march-directive = -march=armv${ARM_ARCH_MAJOR}-a
|
||||
else
|
||||
march32-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
|
||||
march64-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
|
||||
march-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
|
||||
endif #(ARM_ARCH_MINOR)
|
||||
endif #(ARM_ARCH_MAJOR)
|
||||
|
||||
|
@ -273,24 +271,20 @@ endif #(SUPPORT_STACK_MEMTAG)
|
|||
# Set the compiler's architecture feature modifiers
|
||||
ifneq ($(arch-features), none)
|
||||
# Strip "none+" from arch-features
|
||||
arch-features := $(subst none+,,$(arch-features))
|
||||
ifeq ($(ARCH), aarch32)
|
||||
march32-directive := $(march32-directive)+$(arch-features)
|
||||
else
|
||||
march64-directive := $(march64-directive)+$(arch-features)
|
||||
endif
|
||||
arch-features := $(subst none+,,$(arch-features))
|
||||
march-directive := $(march-directive)+$(arch-features)
|
||||
# Print features
|
||||
$(info Arm Architecture Features specified: $(subst +, ,$(arch-features)))
|
||||
endif #(arch-features)
|
||||
|
||||
ifneq ($(findstring clang,$(notdir $(CC))),)
|
||||
ifneq ($(findstring armclang,$(notdir $(CC))),)
|
||||
TF_CFLAGS_aarch32 := -target arm-arm-none-eabi $(march32-directive)
|
||||
TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi $(march64-directive)
|
||||
TF_CFLAGS_aarch32 := -target arm-arm-none-eabi $(march-directive)
|
||||
TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi $(march-directive)
|
||||
LD := $(LINKER)
|
||||
else
|
||||
TF_CFLAGS_aarch32 = $(target32-directive) $(march32-directive)
|
||||
TF_CFLAGS_aarch64 := -target aarch64-elf $(march64-directive)
|
||||
TF_CFLAGS_aarch32 = $(target32-directive) $(march-directive)
|
||||
TF_CFLAGS_aarch64 := -target aarch64-elf $(march-directive)
|
||||
LD := $(shell $(CC) --print-prog-name ld.lld)
|
||||
|
||||
AR := $(shell $(CC) --print-prog-name llvm-ar)
|
||||
|
@ -302,8 +296,8 @@ ifneq ($(findstring clang,$(notdir $(CC))),)
|
|||
PP := $(CC) -E $(TF_CFLAGS_$(ARCH))
|
||||
AS := $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH))
|
||||
else ifneq ($(findstring gcc,$(notdir $(CC))),)
|
||||
TF_CFLAGS_aarch32 = $(march32-directive)
|
||||
TF_CFLAGS_aarch64 = $(march64-directive)
|
||||
TF_CFLAGS_aarch32 = $(march-directive)
|
||||
TF_CFLAGS_aarch64 = $(march-directive)
|
||||
ifeq ($(ENABLE_LTO),1)
|
||||
# Enable LTO only for aarch64
|
||||
ifeq (${ARCH},aarch64)
|
||||
|
@ -314,8 +308,8 @@ else ifneq ($(findstring gcc,$(notdir $(CC))),)
|
|||
endif
|
||||
LD = $(LINKER)
|
||||
else
|
||||
TF_CFLAGS_aarch32 = $(march32-directive)
|
||||
TF_CFLAGS_aarch64 = $(march64-directive)
|
||||
TF_CFLAGS_aarch32 = $(march-directive)
|
||||
TF_CFLAGS_aarch64 = $(march-directive)
|
||||
LD = $(LINKER)
|
||||
endif #(clang)
|
||||
|
||||
|
@ -355,8 +349,7 @@ ifneq (${BP_OPTION},none)
|
|||
TF_CFLAGS_aarch64 += -mbranch-protection=${BP_OPTION}
|
||||
endif #(BP_OPTION)
|
||||
|
||||
ASFLAGS_aarch32 = $(march32-directive)
|
||||
ASFLAGS_aarch64 = $(march64-directive)
|
||||
ASFLAGS += $(march-directive)
|
||||
|
||||
##############################################################################
|
||||
# WARNINGS Configuration
|
||||
|
@ -444,7 +437,7 @@ endif #(E)
|
|||
################################################################################
|
||||
CPPFLAGS = ${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc \
|
||||
$(ERRORS) $(WARNINGS)
|
||||
ASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \
|
||||
ASFLAGS += $(CPPFLAGS) \
|
||||
-ffreestanding -Wa,--fatal-warnings
|
||||
TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \
|
||||
-ffunction-sections -fdata-sections \
|
||||
|
|
|
@ -2733,12 +2733,12 @@ Directive ``ARM_CORTEX_A<x>`` and ``ARM_WITH_NEON`` are used to set
|
|||
the toolchain target architecture directive.
|
||||
|
||||
Platform may choose to not define straight the toolchain target architecture
|
||||
directive by defining ``MARCH32_DIRECTIVE``.
|
||||
directive by defining ``MARCH_DIRECTIVE``.
|
||||
I.e:
|
||||
|
||||
.. code:: make
|
||||
|
||||
MARCH32_DIRECTIVE := -mach=armv7-a
|
||||
MARCH_DIRECTIVE := -mach=armv7-a
|
||||
|
||||
Code Structure
|
||||
--------------
|
||||
|
|
|
@ -15,9 +15,9 @@ endif
|
|||
# armClang requires -march=armv7-a for all ARMv7 Cortex-A. To comply with
|
||||
# all, just drop -march and supply only -mcpu.
|
||||
|
||||
# Platform can override march32-directive through MARCH32_DIRECTIVE
|
||||
ifdef MARCH32_DIRECTIVE
|
||||
march32-directive := $(MARCH32_DIRECTIVE)
|
||||
# Platform can override march-directive through MARCH_DIRECTIVE
|
||||
ifdef MARCH_DIRECTIVE
|
||||
march-directive := $(MARCH_DIRECTIVE)
|
||||
else
|
||||
march32-set-${ARM_CORTEX_A5} := -mcpu=cortex-a5
|
||||
march32-set-${ARM_CORTEX_A7} := -mcpu=cortex-a7
|
||||
|
@ -29,7 +29,7 @@ march32-neon-$(ARM_WITH_NEON) := -mfpu=neon
|
|||
|
||||
# default to -march=armv7-a as target directive
|
||||
march32-set-yes ?= -march=armv7-a
|
||||
march32-directive := ${march32-set-yes} ${march32-neon-yes}
|
||||
march-directive := ${march32-set-yes} ${march32-neon-yes}
|
||||
endif
|
||||
|
||||
# Platform may override these extension support directives:
|
||||
|
|
|
@ -12,7 +12,7 @@ ifeq (${ARM_ARCH_MAJOR},7)
|
|||
# Qemu Cortex-A15 model does not implement the virtualization extension.
|
||||
# For this reason, we cannot set ARM_CORTEX_A15=yes and must define all
|
||||
# the ARMv7 build directives.
|
||||
MARCH32_DIRECTIVE := -mcpu=cortex-a15
|
||||
MARCH_DIRECTIVE := -mcpu=cortex-a15
|
||||
$(eval $(call add_define,ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING))
|
||||
$(eval $(call add_define,ARMV7_SUPPORTS_GENERIC_TIMER))
|
||||
$(eval $(call add_define,ARMV7_SUPPORTS_VFP))
|
||||
|
|
Loading…
Add table
Reference in a new issue