blob: c16cdad8e247b9588111818010234ed53a6978d0 [file] [log] [blame]
Alexei Fedorov7fac1622020-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
13# Select the branch protection features to use.
14BRANCH_PROTECTION := 0
15
16# Flag to enable Branch Target Identification in the TFTF.
17# Internal flag not meant for direct setting.
18# Use BRANCH_PROTECTION to enable BTI.
19ENABLE_BTI := 0
20
21# Enable Pointer Authentication support in the TFTF.
22# Internal flag not meant for direct setting.
23# Use BRANCH_PROTECTION to enable PAUTH.
24ENABLE_PAUTH := 0
25
26# Process BRANCH_PROTECTION value and set
27# Pointer Authentication and Branch Target Identification flags
28ifeq (${BRANCH_PROTECTION},0)
29 # Default value turns off all types of branch protection
30 BP_OPTION := none
31else ifneq (${ARCH},aarch64)
32 $(error BRANCH_PROTECTION requires AArch64)
33else ifeq (${BRANCH_PROTECTION},1)
34 # Enables all types of branch protection features
35 BP_OPTION := standard
36 ENABLE_BTI := 1
37 ENABLE_PAUTH := 1
38else ifeq (${BRANCH_PROTECTION},2)
39 # Return address signing to its standard level
40 BP_OPTION := pac-ret
41 ENABLE_PAUTH := 1
42else ifeq (${BRANCH_PROTECTION},3)
43 # Extend the signing to include leaf functions
44 BP_OPTION := pac-ret+leaf
45 ENABLE_PAUTH := 1
46else ifeq (${BRANCH_PROTECTION},4)
47 # Turn on branch target identification mechanism
48 BP_OPTION := bti
49 ENABLE_BTI := 1
50else
51 $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION})
52endif