diff options
author | schmonz <schmonz@pkgsrc.org> | 2018-11-05 19:26:38 +0000 |
---|---|---|
committer | schmonz <schmonz@pkgsrc.org> | 2018-11-05 19:26:38 +0000 |
commit | 7921cce1697ce4b1f77dfad2abe484e991350c06 (patch) | |
tree | 27e54b65800fed5b19702597c0864093b9aeb20a /bootstrap | |
parent | 5dedcc50b8218e9cebb0dec00e70b3130b34427f (diff) | |
download | pkgsrc-7921cce1697ce4b1f77dfad2abe484e991350c06.tar.gz |
Optionally detect whether the compiler supports "-fstack-protector-strong".
If not, set _OPSYS_SUPPORTS_SSP=no during bootstrap and in mk.conf.
Do SSP detection on "SunOS", and let mk/platform/SunOS.mk's default
"yes" be overridden in mk.conf.
No change to generated mk.conf on NetBSD 8 or CentOS 6. Fixes bootstrap
on Tribblix.
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap/bootstrap | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index 23f9a2ccf57..0e6a76beed4 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: bootstrap,v 1.256 2018/10/30 15:22:53 sevan Exp $ +# $NetBSD: bootstrap,v 1.257 2018/11/05 19:26:38 schmonz Exp $ # # Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org> # All rights reserved. @@ -841,6 +841,7 @@ SunOS) whoamiprog="${idprog} -un" machine_arch=`uname -p | sed -e 's/i86pc/i386/'` check_compiler=yes + check_ssp=yes ;; UnixWare) root_group=sys @@ -991,6 +992,27 @@ if [ "$compiler" = "" ] && [ x"$check_compiler" = x"yes" ]; then fi fi +has_ssp_support() { + _compiler=cc + if [ "$compiler" != "" ]; then + _compiler="$compiler" + fi + + mkdir_p_early ${wrkdir}/tmp + echo 'int main(void){return 0;}' > ${wrkdir}/tmp/ssp.c + ${_compiler} -fstack-protector-strong -o ${wrkdir}/tmp/ssp ${wrkdir}/tmp/ssp.c >/dev/null 2>&1 + + if [ $? -eq 0 ]; then + echo yes + else + echo no + fi +} + +if [ "$has_ssp" = "" ] && [ x"$check_ssp" = x"yes" ]; then + has_ssp=`has_ssp_support` +fi + mkdir_p_early ${wrkdir}/bin # build install-sh @@ -1025,6 +1047,9 @@ fi PKG_DBDIR=$pkgdbdir; export PKG_DBDIR LOCALBASE=$prefix; export LOCALBASE VARBASE=$varbase; export VARBASE +if [ x"$has_ssp" = x"no" ] && [ x"$check_ssp" = x"yes" ]; then +_OPSYS_SUPPORTS_SSP=no; export _OPSYS_SUPPORTS_SSP +fi # set up an example mk.conf file TARGET_MKCONF=${wrkdir}/mk.conf.example @@ -1072,6 +1097,10 @@ if [ -n "$SUNWSPROBASE" ]; then fi echo "" >> ${TARGET_MKCONF} +if [ x"$has_ssp" = x"no" ] && [ x"$check_ssp" = x"yes" ]; then + echo "_OPSYS_SUPPORTS_SSP= no" >> ${TARGET_MKCONF} +fi + # enable unprivileged builds if not root if [ "$unprivileged" = "yes" ]; then echo "UNPRIVILEGED= yes" >> ${TARGET_MKCONF} |