diff options
author | Vicente Olivert Riera <Vincent.Riera@imgtec.com> | 2016-03-15 16:40:38 +0000 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2016-05-23 21:07:24 +0200 |
commit | 794935068bf67171dd101c673c3cb4954035a413 (patch) | |
tree | c382c19c719ecb6cc6f16a41025c2ea0b74f6920 /toolchain/helpers.mk | |
parent | 925f0897fecbd3d47c432fa6c41bfd0027e5ceb5 (diff) |
toolchain: improve SSP logic
Don't enable SSP support on external toolchains just because they use
glibc or musl. Instead of that, make the external toolchains explictily
declare if they support SSP or not. And also add a check to detect SSP
support when using custom external toolchains.
For internal toolchains we always enable SSP support for glibc and musl.
Fixes:
http://autobuild.buildroot.net/results/ac7c9b3ad2e52abfe6b79a80045e4218eeb87175/
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
[Thomas:
- remove uClibc-specific SSP check, since there is now a generic
check being done.
- send potential compilation errors caused by the SSP check to
oblivion, in order to avoid causing confusion for the user.
- add autobuilder reference.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'toolchain/helpers.mk')
-rw-r--r-- | toolchain/helpers.mk | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index d28a2caed..551275967 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -294,8 +294,7 @@ check_uclibc = \ $(call check_uclibc_feature,__UCLIBC_HAS_WCHAR__,BR2_USE_WCHAR,$${UCLIBC_CONFIG_FILE},Wide char support) ;\ $(call check_uclibc_feature,__UCLIBC_HAS_THREADS__,BR2_TOOLCHAIN_HAS_THREADS,$${UCLIBC_CONFIG_FILE},Thread support) ;\ $(call check_uclibc_feature,__PTHREADS_DEBUG_SUPPORT__,BR2_TOOLCHAIN_HAS_THREADS_DEBUG,$${UCLIBC_CONFIG_FILE},Thread debugging support) ;\ - $(call check_uclibc_feature,__UCLIBC_HAS_THREADS_NATIVE__,BR2_TOOLCHAIN_HAS_THREADS_NPTL,$${UCLIBC_CONFIG_FILE},NPTL thread support) ;\ - $(call check_uclibc_feature,__UCLIBC_HAS_SSP__,BR2_TOOLCHAIN_HAS_SSP,$${UCLIBC_CONFIG_FILE},Stack Smashing Protection support) + $(call check_uclibc_feature,__UCLIBC_HAS_THREADS_NATIVE__,BR2_TOOLCHAIN_HAS_THREADS_NPTL,$${UCLIBC_CONFIG_FILE},NPTL thread support) # # Check that the Buildroot configuration of the ABI matches the @@ -387,6 +386,24 @@ check_unusable_toolchain = \ fi # +# Check if the toolchain has SSP (stack smashing protector) support +# +# $1: cross-gcc path +# +check_toolchain_ssp = \ + __CROSS_CC=$(strip $1) ; \ + __HAS_SSP=`echo 'void main(){}' | $${__CROSS_CC} -fstack-protector -x c - -o $(BUILD_DIR)/.br-toolchain-test.tmp >/dev/null 2>&1 && echo y` ; \ + if [ "$(BR2_TOOLCHAIN_HAS_SSP)" != "y" -a "$${__HAS_SSP}" = "y" ] ; then \ + echo "SSP support available in this toolchain, please enable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP" ; \ + exit 1 ; \ + fi ; \ + if [ "$(BR2_TOOLCHAIN_HAS_SSP)" = "y" -a "$${__HAS_SSP}" != "y" ] ; then \ + echo "SSP support not available in this toolchain, please disable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP" ; \ + exit 1 ; \ + fi ; \ + rm -f $(BUILD_DIR)/.br-toolchain-test.tmp* + +# # Generate gdbinit file for use with Buildroot # gen_gdbinit_file = \ |