toolchain/buildroot: properly handle SSP
The current SSP handling is incomplete. First we need to build uClibc with SSP support for a complete "experience". Second, it doesn't hurt to add -fstack-protector-all to the CFLAGS/CXXFLAGS since most users would expect buildroot to do this rather than adding the flags themselves. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
a8b0a3f870
commit
808cc0a5e1
@ -124,6 +124,11 @@ TARGET_CFLAGS += -msep-data
|
|||||||
TARGET_CXXFLAGS += -msep-data
|
TARGET_CXXFLAGS += -msep-data
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
|
||||||
|
TARGET_CFLAGS += -fstack-protector-all
|
||||||
|
TARGET_CXXFLAGS += -fstack-protector-all
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
|
ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
|
||||||
TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
|
TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
|
||||||
else
|
else
|
||||||
|
@ -251,9 +251,15 @@ endif
|
|||||||
# SSP
|
# SSP
|
||||||
#
|
#
|
||||||
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
|
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
|
||||||
UCLIBC_SSP_CONFIG = $(call UCLIBC_OPT_SET,UCLIBC_HAS_SSP,y,$(@D))
|
define UCLIBC_SSP_CONFIG
|
||||||
|
$(call UCLIBC_OPT_SET,UCLIBC_HAS_SSP,y,$(@D))
|
||||||
|
$(call UCLIBC_OPT_SET,UCLIBC_BUILD_SSP,y,$(@D))
|
||||||
|
endef
|
||||||
else
|
else
|
||||||
UCLIBC_SSP_CONFIG = $(call UCLIBC_OPT_UNSET,UCLIBC_HAS_SSP,$(@D))
|
define UCLIBC_SSP_CONFIG
|
||||||
|
$(call UCLIBC_OPT_UNSET,UCLIBC_HAS_SSP,$(@D))
|
||||||
|
$(call UCLIBC_OPT_UNSET,UCLIBC_BUILD_SSP,$(@D))
|
||||||
|
endef
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -21,7 +21,7 @@ config BR2_TOOLCHAIN_BUILDROOT_USE_SSP
|
|||||||
bool "Enable stack protection support"
|
bool "Enable stack protection support"
|
||||||
help
|
help
|
||||||
Enable stack smashing protection support using GCCs
|
Enable stack smashing protection support using GCCs
|
||||||
-fstack-protector[-all] option.
|
-fstack-protector-all option.
|
||||||
|
|
||||||
See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
|
See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
|
||||||
for details.
|
for details.
|
||||||
|
Loading…
Reference in New Issue
Block a user