blob: b5aba1528e27de29390cb034ccb3f04ac87346b7 [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
Simon Southda129242019-10-20 13:54:32 -040014ifeq (${ENABLE_STACK_PROTECTOR},none)
15 TF_CFLAGS += -fno-stack-protector
16else
Louis Mayencourt768bf0c2019-03-26 16:59:26 +000017 STACK_PROTECTOR_ENABLED := 1
18 BL_COMMON_SOURCES += lib/stack_protector/stack_protector.c \
Douglas Raillard306593d2017-02-24 18:14:15 +000019 lib/stack_protector/${ARCH}/asm_stack_protector.S
20
Louis Mayencourt768bf0c2019-03-26 16:59:26 +000021 ifeq (${ENABLE_STACK_PROTECTOR},default)
22 TF_CFLAGS += -fstack-protector
23 else
24 TF_CFLAGS += -fstack-protector-${ENABLE_STACK_PROTECTOR}
25 endif
Douglas Raillard306593d2017-02-24 18:14:15 +000026endif
27
28$(eval $(call add_define,STACK_PROTECTOR_ENABLED))