aboutsummaryrefslogtreecommitdiff
path: root/Mk/bsd.ssp.mk
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2013-09-20 12:54:54 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2013-09-20 12:54:54 +0000
commitc93dfc2e9f8b7b990c22c6baa6cdab361cd12e16 (patch)
treee61ab76efa292f985d8e20e449572329fa964c1c /Mk/bsd.ssp.mk
parentb10d5a64b7ea8bb32e9735304272e7344926e3b2 (diff)
downloadports-c93dfc2e9f8b7b990c22c6baa6cdab361cd12e16.tar.gz
ports-c93dfc2e9f8b7b990c22c6baa6cdab361cd12e16.zip
Notes
Diffstat (limited to 'Mk/bsd.ssp.mk')
-rw-r--r--Mk/bsd.ssp.mk30
1 files changed, 30 insertions, 0 deletions
diff --git a/Mk/bsd.ssp.mk b/Mk/bsd.ssp.mk
new file mode 100644
index 000000000000..c71b3b3722c4
--- /dev/null
+++ b/Mk/bsd.ssp.mk
@@ -0,0 +1,30 @@
+# $FreeBSD$
+# SSP Support
+
+SSP_Include_MAINTAINER= portmgr@FreeBSD.org
+
+# See: http://svnweb.freebsd.org/base/head/lib/libc/libc.ldscript?revision=251668&view=markup
+.if ${OSVERSION} < 1000036 && ${ARCH} == i386
+
+# Disabled on i386 for now on releases without the ldscript as too many ports
+# do not respect LDFLAGS and fail to build due to not adding in -lssp_nonshared when needed
+# despite dependencies working fine, which breaks a lot. Can enable once LDFLAGS is more
+# supported. XXX
+SSP_UNSAFE= yes
+
+# i386 needs -lssp_nonshared, see svn link above for more information
+SSP_NEED_NONSHARED= yes
+.endif
+
+.if defined(WITH_SSP) && !defined(WITHOUT_SSP) && !defined(SSP_UNSAFE) && \
+ (${ARCH} == i386 || ${ARCH} == amd64)
+# Overridable as a user may want to use -fstack-protector-all
+SSP_CFLAGS?= -fstack-protector
+CFLAGS:= ${CFLAGS} ${SSP_CFLAGS}
+LDFLAGS:= ${LDFLAGS} -fstack-protector
+# -lssp_nonshared is needed on i386 where /usr/lib/libc.so is not an ldscript
+# This is currently unused XXX
+. if defined(SSP_NEED_NONSHARED)
+LDFLAGS:= ${LDFLAGS} -lssp_nonshared
+. endif
+.endif