summaryrefslogtreecommitdiff
path: root/mk/platform/NetBSD.mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/platform/NetBSD.mk')
-rw-r--r--mk/platform/NetBSD.mk40
1 files changed, 28 insertions, 12 deletions
diff --git a/mk/platform/NetBSD.mk b/mk/platform/NetBSD.mk
index c2666e2df37..d5270fedc05 100644
--- a/mk/platform/NetBSD.mk
+++ b/mk/platform/NetBSD.mk
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.mk,v 1.46 2016/03/10 16:58:19 jperkin Exp $
+# $NetBSD: NetBSD.mk,v 1.47 2016/03/11 23:03:31 khorben Exp $
#
# Variable definitions for the NetBSD operating system.
@@ -123,19 +123,35 @@ FFLAGS+= -mieee
PKG_HAVE_KQUEUE= # defined
.endif
-.if ${PKGSRC_USE_FORT:Uno} != "no"
-# build with fortify
-_GCC_CFLAGS+= -D_FORTIFY_SOURCE=2
+# Register support for FORTIFY where supported (with GCC)
+_OPSYS_SUPPORTS_FORTIFY=yes
+_FORTIFY_CFLAGS.gcc= -D_FORTIFY_SOURCE=2
+
+# Register support for PIE on supported architectures (with GCC)
+.if (${MACHINE_ARCH} == "i386") || \
+ (${MACHINE_ARCH} == "x86_64")
+_OPSYS_SUPPORTS_MKPIE= yes
+_MKPIE_CFLAGS.gcc= -fPIC
+# XXX for executables it should be:
+#_MKPIE_CFLAGS.gcc= -fPIE
+# XXX for libraries a sink wrapper around gcc is required and used instead
+#_MKPIE_LDFLAGS.gcc= -pie
.endif
-.if ${PKGSRC_USE_SSP:Uno} != "no"
-. if (${MACHINE_ARCH} != "alpha") && \
- (${MACHINE_ARCH} != "hppa") && \
- (${MACHINE_ARCH} != "ia64") && \
- (${MACHINE_ARCH} != "mips")
-# build with stack protection (with GCC)
-_GCC_CFLAGS+= -fstack-protector
-. endif
+# Register support for RELRO on supported architectures (with GCC)
+.if (${MACHINE_ARCH} == "i386") || \
+ (${MACHINE_ARCH} == "x86_64")
+_OPSYS_SUPPORTS_RELRO= yes
+_RELRO_LDFLAGS.gcc= -Wl,-z,relro -Wl,-z,now
+.endif
+
+# Register support for SSP on most architectures (with GCC)
+.if (${MACHINE_ARCH} != "alpha") && \
+ (${MACHINE_ARCH} != "hppa") && \
+ (${MACHINE_ARCH} != "ia64") && \
+ (${MACHINE_ARCH} != "mips")
+_OPSYS_SUPPORTS_SSP= yes
+_SSP_CFLAGS.gcc= -fstack-protector-all
.endif
_OPSYS_CAN_CHECK_SHLIBS= yes # use readelf in check/bsd.check-vars.mk