TFTF: Add build option for Arm Feature Modifiers
This patch adds a new ARM_ARCH_FEATURE build option
to add support for compiler's feature modifiers.
It has the form '[no]feature+...' and defaults to
'none'. This option translates into compiler option
'-march=armvX[.Y]-a+[no]feature+...'.
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Change-Id: I115a921c777b7932523d2dff8e8e03377d87bb78
diff --git a/Makefile b/Makefile
index 661f52b..a758b8a 100644
--- a/Makefile
+++ b/Makefile
@@ -180,13 +180,27 @@
# Set the compiler's target architecture profile based on ARM_ARCH_MINOR option
ifeq (${ARM_ARCH_MINOR},0)
-march32-directive = -march=armv8-a
-march64-directive = -march=armv8-a
+march32-directive = -march=armv${ARM_ARCH_MAJOR}-a
+march64-directive = -march=armv${ARM_ARCH_MAJOR}-a
else
-march32-directive = -march=armv8.${ARM_ARCH_MINOR}-a
-march64-directive = -march=armv8.${ARM_ARCH_MINOR}-a
+march32-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
+march64-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a
endif
+# Get architecture feature modifiers
+arch-features = ${ARM_ARCH_FEATURE}
+
+# Set the compiler's architecture feature modifiers
+ifneq ($(arch-features), none)
+ifeq ($(ARCH), aarch32)
+march32-directive := $(march32-directive)+$(arch-features)
+else
+march64-directive := $(march64-directive)+$(arch-features)
+endif
+# Print features
+$(info Arm Architecture Features specified: $(subst +, ,$(arch-features)))
+endif # arch-features
+
COMMON_ASFLAGS_aarch64 := -mgeneral-regs-only ${march64-directive}
COMMON_CFLAGS_aarch64 := -mgeneral-regs-only -mstrict-align ${march64-directive}
diff --git a/docs/getting_started/build-options.rst b/docs/getting_started/build-options.rst
index 8815466..d8ffe8b 100644
--- a/docs/getting_started/build-options.rst
+++ b/docs/getting_started/build-options.rst
@@ -24,6 +24,12 @@
either ``aarch64`` or ``aarch32`` as values. By default, it is defined to
``aarch64``. Not all test images support this build option.
+- ``ARM_ARCH_FEATURE``: Optional Arm Architecture build option which specifies
+ one or more feature modifiers. This option has the form ``[no]feature+...``
+ and defaults to ``none``. It translates into compiler option
+ ``-march=armvX[.Y]-a+[no]feature+...``. See compiler's documentation for the
+ list of supported feature modifiers.
+
- ``ARM_ARCH_MAJOR``: The major version of Arm Architecture to target when
compiling TF-A Tests. Its value must be numeric, and defaults to 8.
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index ca44b47..2e18d67 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -13,6 +13,9 @@
# The Target build architecture. Supported values are: aarch64, aarch32.
ARCH := aarch64
+# ARM Architecture feature modifiers: none by default
+ARM_ARCH_FEATURE := none
+
# ARM Architecture major and minor versions: 8.0 by default.
ARM_ARCH_MAJOR := 8
ARM_ARCH_MINOR := 0