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