blob: 86f197f95ec4ba3322a3628d17071f97c1c13a5a [file] [log] [blame]
Alexei Fedorov34057072020-06-19 14:25:43 +01001#
2# Copyright (c) 2020, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# Default, static values for build variables, listed in alphabetic order.
8# Dependencies between build options, if any, are handled in the top-level
9# Makefile, after this file is included. This ensures that the former is better
10# poised to handle dependencies, as all build variables would have a default
11# value by then.
12
Alexei Fedorov34057072020-06-19 14:25:43 +010013# Flag to enable Branch Target Identification in the TFTF.
14# Internal flag not meant for direct setting.
15# Use BRANCH_PROTECTION to enable BTI.
16ENABLE_BTI := 0
17
18# Enable Pointer Authentication support in the TFTF.
19# Internal flag not meant for direct setting.
20# Use BRANCH_PROTECTION to enable PAUTH.
21ENABLE_PAUTH := 0
22
23# Process BRANCH_PROTECTION value and set
24# Pointer Authentication and Branch Target Identification flags
25ifeq (${BRANCH_PROTECTION},0)
26 # Default value turns off all types of branch protection
27 BP_OPTION := none
28else ifneq (${ARCH},aarch64)
29 $(error BRANCH_PROTECTION requires AArch64)
30else ifeq (${BRANCH_PROTECTION},1)
31 # Enables all types of branch protection features
32 BP_OPTION := standard
33 ENABLE_BTI := 1
34 ENABLE_PAUTH := 1
35else ifeq (${BRANCH_PROTECTION},2)
36 # Return address signing to its standard level
37 BP_OPTION := pac-ret
38 ENABLE_PAUTH := 1
39else ifeq (${BRANCH_PROTECTION},3)
40 # Extend the signing to include leaf functions
41 BP_OPTION := pac-ret+leaf
42 ENABLE_PAUTH := 1
43else ifeq (${BRANCH_PROTECTION},4)
44 # Turn on branch target identification mechanism
45 BP_OPTION := bti
46 ENABLE_BTI := 1
47else
48 $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION})
49endif