blob: 94e804be9ccc3a46d3d50ed46092e4c44331667e [file] [log] [blame]
Douglas Raillard306593d2017-02-24 18:14:15 +00001#
Louis Mayencourt768bf0c2019-03-26 16:59:26 +00002# Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
Douglas Raillard306593d2017-02-24 18:14:15 +00003#
dp-armfa3cf0b2017-05-03 09:38:09 +01004# SPDX-License-Identifier: BSD-3-Clause
Douglas Raillard306593d2017-02-24 18:14:15 +00005#
6
7# Boolean macro to be used in C code
8STACK_PROTECTOR_ENABLED := 0
9
Louis Mayencourt768bf0c2019-03-26 16:59:26 +000010ifeq (${ENABLE_STACK_PROTECTOR},0)
11 ENABLE_STACK_PROTECTOR := none
12endif
13
14ifneq (${ENABLE_STACK_PROTECTOR},none)
15 STACK_PROTECTOR_ENABLED := 1
16 BL_COMMON_SOURCES += lib/stack_protector/stack_protector.c \
Douglas Raillard306593d2017-02-24 18:14:15 +000017 lib/stack_protector/${ARCH}/asm_stack_protector.S
18
Louis Mayencourt768bf0c2019-03-26 16:59:26 +000019 ifeq (${ENABLE_STACK_PROTECTOR},default)
20 TF_CFLAGS += -fstack-protector
21 else
22 TF_CFLAGS += -fstack-protector-${ENABLE_STACK_PROTECTOR}
23 endif
Douglas Raillard306593d2017-02-24 18:14:15 +000024endif
25
26$(eval $(call add_define,STACK_PROTECTOR_ENABLED))