Douglas Raillard | 306593d | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 1 | # |
Govindraj Raja | eee28e7 | 2023-08-01 15:52:40 -0500 | [diff] [blame] | 2 | # Copyright (c) 2017-2019, Arm Limited and Contributors. All rights reserved. |
Douglas Raillard | 306593d | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Douglas Raillard | 306593d | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 5 | # |
| 6 | |
| 7 | # Boolean macro to be used in C code |
| 8 | STACK_PROTECTOR_ENABLED := 0 |
| 9 | |
Louis Mayencourt | 768bf0c | 2019-03-26 16:59:26 +0000 | [diff] [blame] | 10 | ifeq (${ENABLE_STACK_PROTECTOR},0) |
| 11 | ENABLE_STACK_PROTECTOR := none |
| 12 | endif |
| 13 | |
Simon South | da12924 | 2019-10-20 13:54:32 -0400 | [diff] [blame] | 14 | ifeq (${ENABLE_STACK_PROTECTOR},none) |
| 15 | TF_CFLAGS += -fno-stack-protector |
| 16 | else |
Louis Mayencourt | 768bf0c | 2019-03-26 16:59:26 +0000 | [diff] [blame] | 17 | STACK_PROTECTOR_ENABLED := 1 |
| 18 | BL_COMMON_SOURCES += lib/stack_protector/stack_protector.c \ |
Douglas Raillard | 306593d | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 19 | lib/stack_protector/${ARCH}/asm_stack_protector.S |
| 20 | |
Louis Mayencourt | 768bf0c | 2019-03-26 16:59:26 +0000 | [diff] [blame] | 21 | ifeq (${ENABLE_STACK_PROTECTOR},default) |
| 22 | TF_CFLAGS += -fstack-protector |
| 23 | else |
| 24 | TF_CFLAGS += -fstack-protector-${ENABLE_STACK_PROTECTOR} |
| 25 | endif |
Douglas Raillard | 306593d | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 26 | endif |
| 27 | |
| 28 | $(eval $(call add_define,STACK_PROTECTOR_ENABLED)) |