• Simon South's avatar
    Disable stack protection explicitly · 7af195e2
    Simon South authored
    
    Explicitly disable stack protection via the "-fno-stack-protector"
    compiler option when the ENABLE_STACK_PROTECTOR build option is
    set to "none" (the default).
    
    This allows the build to complete without link errors on systems where
    stack protection is enabled by default in the compiler.
    
    Change-Id: I0a676aa672815235894fb2cd05fa2b196fabb972
    Signed-off-by: default avatarSimon South <simon@simonsouth.net>
    7af195e2
stack_protector.mk 725 Bytes
#
# Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#

# Boolean macro to be used in C code
STACK_PROTECTOR_ENABLED := 0

ifeq (${ENABLE_STACK_PROTECTOR},0)
  ENABLE_STACK_PROTECTOR := none
endif

ifeq (${ENABLE_STACK_PROTECTOR},none)
  TF_CFLAGS            +=      -fno-stack-protector
else
  STACK_PROTECTOR_ENABLED := 1
  BL_COMMON_SOURCES	+=	lib/stack_protector/stack_protector.c	\
				lib/stack_protector/${ARCH}/asm_stack_protector.S

  ifeq (${ENABLE_STACK_PROTECTOR},default)
    TF_CFLAGS		+=	-fstack-protector
  else
    TF_CFLAGS		+=	-fstack-protector-${ENABLE_STACK_PROTECTOR}
  endif
endif

$(eval $(call add_define,STACK_PROTECTOR_ENABLED))