Douglas Raillard | 51faada | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 1 | # |
Louis Mayencourt | fd7b287 | 2019-03-26 16:59:26 +0000 | [diff] [blame] | 2 | # Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. |
Douglas Raillard | 51faada | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 3 | # |
dp-arm | 82cb2c1 | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Douglas Raillard | 51faada | 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 | fd7b287 | 2019-03-26 16:59:26 +0000 | [diff] [blame] | 10 | ifeq (${ENABLE_STACK_PROTECTOR},0) |
| 11 | ENABLE_STACK_PROTECTOR := none |
| 12 | endif |
| 13 | |
| 14 | ifneq (${ENABLE_STACK_PROTECTOR},none) |
| 15 | STACK_PROTECTOR_ENABLED := 1 |
| 16 | BL_COMMON_SOURCES += lib/stack_protector/stack_protector.c \ |
Douglas Raillard | 51faada | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 17 | lib/stack_protector/${ARCH}/asm_stack_protector.S |
| 18 | |
Louis Mayencourt | fd7b287 | 2019-03-26 16:59:26 +0000 | [diff] [blame] | 19 | ifeq (${ENABLE_STACK_PROTECTOR},default) |
| 20 | TF_CFLAGS += -fstack-protector |
| 21 | else |
| 22 | TF_CFLAGS += -fstack-protector-${ENABLE_STACK_PROTECTOR} |
| 23 | endif |
Douglas Raillard | 51faada | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 24 | endif |
| 25 | |
| 26 | $(eval $(call add_define,STACK_PROTECTOR_ENABLED)) |