pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc Optionally detect whether the compiler supports "-fsta...
details: https://anonhg.NetBSD.org/pkgsrc/rev/4c30b0ae2b9d
branches: trunk
changeset: 314723:4c30b0ae2b9d
user: schmonz <schmonz%pkgsrc.org@localhost>
date: Mon Nov 05 19:26:38 2018 +0000
description:
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:
bootstrap/bootstrap | 31 ++++++++++++++++++++++++++++++-
mk/platform/SunOS.mk | 4 ++--
2 files changed, 32 insertions(+), 3 deletions(-)
diffs (86 lines):
diff -r d619ad130371 -r 4c30b0ae2b9d bootstrap/bootstrap
--- a/bootstrap/bootstrap Mon Nov 05 19:01:21 2018 +0000
+++ b/bootstrap/bootstrap Mon Nov 05 19:26:38 2018 +0000
@@ -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@localhost>
# All rights reserved.
@@ -841,6 +841,7 @@
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 @@
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 @@
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 @@
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}
diff -r d619ad130371 -r 4c30b0ae2b9d mk/platform/SunOS.mk
--- a/mk/platform/SunOS.mk Mon Nov 05 19:01:21 2018 +0000
+++ b/mk/platform/SunOS.mk Mon Nov 05 19:26:38 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: SunOS.mk,v 1.77 2017/10/10 13:57:23 jperkin Exp $
+# $NetBSD: SunOS.mk,v 1.78 2018/11/05 19:26:38 schmonz Exp $
#
# Variable definitions for the SunOS/Solaris operating system.
@@ -131,7 +131,7 @@
_OPSYS_SUPPORTS_FORTIFY=yes
# support stack protection (with GCC)
-_OPSYS_SUPPORTS_SSP= yes
+_OPSYS_SUPPORTS_SSP?= yes
_OPSYS_CAN_CHECK_SHLIBS= yes # requires readelf
Home |
Main Index |
Thread Index |
Old Index