pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Register support for SSP on FreeBSD and clang (on x...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2d41f9fe0acf
branches:  trunk
changeset: 362568:2d41f9fe0acf
user:      khorben <khorben%pkgsrc.org@localhost>
date:      Thu May 18 01:29:55 2017 +0000

description:
Register support for SSP on FreeBSD and clang (on x86 architectures)

Support for SSP (Stack-Smashing Protection) is optional so this should not
affect default builds.

Tested on FreeBSD/amd64 (10.3-RELEASE-p11)

diffstat:

 mk/compiler/clang.mk   |  17 ++++++++++++++++-
 mk/platform/FreeBSD.mk |   8 +++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diffs (53 lines):

diff -r 2373e30bf894 -r 2d41f9fe0acf mk/compiler/clang.mk
--- a/mk/compiler/clang.mk      Wed May 17 22:04:08 2017 +0000
+++ b/mk/compiler/clang.mk      Thu May 18 01:29:55 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: clang.mk,v 1.15 2015/03/02 19:59:07 joerg Exp $
+# $NetBSD: clang.mk,v 1.16 2017/05/18 01:29:55 khorben Exp $
 #
 # This is the compiler definition for the clang compiler.
 #
@@ -53,6 +53,21 @@
 _LINKER_RPATH_FLAG=    -R
 _COMPILER_RPATH_FLAG=  ${_COMPILER_LD_FLAG}${_LINKER_RPATH_FLAG}
 
+# The user can choose the level of stack smashing protection.
+.if ${PKGSRC_USE_SSP} == "all"
+_SSP_CFLAGS=           -fstack-protector-all
+.else
+_SSP_CFLAGS=           -fstack-protector
+.endif
+
+.if ${_PKGSRC_USE_SSP} == "yes"
+_WRAP_EXTRA_ARGS.CC+=  ${_SSP_CFLAGS}
+_WRAP_EXTRA_ARGS.CXX+= ${_SSP_CFLAGS}
+CWRAPPERS_APPEND.cc+=  ${_SSP_CFLAGS}
+CWRAPPERS_APPEND.cxx+= ${_SSP_CFLAGS}
+CWRAPPERS_APPEND.f77+= ${_SSP_CFLAGS}
+.endif
+
 # _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the
 # ones requested by the package in USE_LANGUAGES.
 #
diff -r 2373e30bf894 -r 2d41f9fe0acf mk/platform/FreeBSD.mk
--- a/mk/platform/FreeBSD.mk    Wed May 17 22:04:08 2017 +0000
+++ b/mk/platform/FreeBSD.mk    Thu May 18 01:29:55 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: FreeBSD.mk,v 1.33 2016/12/04 15:37:41 bsiegert Exp $
+# $NetBSD: FreeBSD.mk,v 1.34 2017/05/18 01:29:56 khorben Exp $
 #
 # Variable definitions for the FreeBSD operating system.
 
@@ -63,6 +63,12 @@
 PKG_HAVE_KQUEUE=       # defined
 .endif
 
+# Register support for SSP on x86 architectures
+.if (${MACHINE_ARCH} == "i386") || \
+    (${MACHINE_ARCH} == "x86_64")
+_OPSYS_SUPPORTS_SSP=   yes
+.endif
+
 _OPSYS_SUPPORTS_CWRAPPERS=     yes
 _OPSYS_CAN_CHECK_SHLIBS=       yes # use readelf in check/bsd.check-vars.mk
 



Home | Main Index | Thread Index | Old Index