TFTF: Add ARMv8.5 BTI support in makefiles
This patch adds 'BRANCH_PROTECTION' build option in
TFTF makefiles which corresponds to that in TF-A.
The option values are documented in 'build-options.rst'
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Change-Id: Iad5083aee339cec574acf5e7ab1fd8142877a122
diff --git a/Makefile b/Makefile
index fea13db..a229d0a 100644
--- a/Makefile
+++ b/Makefile
@@ -149,13 +149,20 @@
################################################################################
$(eval $(call assert_boolean,DEBUG))
$(eval $(call assert_boolean,ENABLE_ASSERTIONS))
-$(eval $(call assert_boolean,ENABLE_PAUTH))
$(eval $(call assert_boolean,FIRMWARE_UPDATE))
$(eval $(call assert_boolean,FWU_BL_TEST))
$(eval $(call assert_boolean,NEW_TEST_SESSION))
$(eval $(call assert_boolean,USE_NVM))
################################################################################
+# Process build options
+################################################################################
+
+# Process BRANCH_PROTECTION value and set
+# Pointer Authentication and Branch Target Identification flags
+include branch_protection.mk
+
+################################################################################
# Add definitions to the cpp preprocessor based on the current build options.
# This is done after including the platform specific makefile to allow the
# platform to overwrite the default options
@@ -164,6 +171,7 @@
$(eval $(call add_define,TFTF_DEFINES,ARM_ARCH_MINOR))
$(eval $(call add_define,TFTF_DEFINES,DEBUG))
$(eval $(call add_define,TFTF_DEFINES,ENABLE_ASSERTIONS))
+$(eval $(call add_define,TFTF_DEFINES,ENABLE_BTI))
$(eval $(call add_define,TFTF_DEFINES,ENABLE_PAUTH))
$(eval $(call add_define,TFTF_DEFINES,LOG_LEVEL))
$(eval $(call add_define,TFTF_DEFINES,NEW_TEST_SESSION))
@@ -230,10 +238,14 @@
TFTF_ASFLAGS += ${COMMON_ASFLAGS}
TFTF_LDFLAGS += ${COMMON_LDFLAGS}
-ifeq (${ENABLE_PAUTH},1)
-TFTF_CFLAGS += -mbranch-protection=pac-ret
-NS_BL1U_CFLAGS += -mbranch-protection=pac-ret
-NS_BL2U_CFLAGS += -mbranch-protection=pac-ret
+ifneq (${BP_OPTION},none)
+TFTF_CFLAGS += -mbranch-protection=${BP_OPTION}
+NS_BL1U_CFLAGS += -mbranch-protection=${BP_OPTION}
+NS_BL2U_CFLAGS += -mbranch-protection=${BP_OPTION}
+CACTUS_MM_CFLAGS += -mbranch-protection=${BP_OPTION}
+CACTUS_CFLAGS += -mbranch-protection=${BP_OPTION}
+IVY_CFLAGS += -mbranch-protection=${BP_OPTION}
+QUARK_CFLAGS += -mbranch-protection=${BP_OPTION}
endif
#####################################################################################