summaryrefslogtreecommitdiff
path: root/mk/compiler
diff options
context:
space:
mode:
authorkhorben <khorben@pkgsrc.org>2017-08-25 01:43:17 +0000
committerkhorben <khorben@pkgsrc.org>2017-08-25 01:43:17 +0000
commite720d2a0372a64ecb9719eff49bee8e8ee613a17 (patch)
tree29e4fa3bf8b3cb982d75eaa0f60af9ccb750e77f /mk/compiler
parent08f54d673128585df6067eb8442924d5e8cab818 (diff)
downloadpkgsrc-e720d2a0372a64ecb9719eff49bee8e8ee613a17.tar.gz
Add support for PKGSRC_MKPIE with cwrappers
This is based on a patch submitted on 16/04/2017 on tech-pkg@ and adapted by joerg@ for pkgtools/cwrappers. It only consists in the missing part to actually generate PIE executables with cwrappers if configured to do so (currently disabled by default). The aim is really to produce safer binaries where ASLR is in use. This part in pkgsrc is only supported on NetBSD (x86) with GCC at the moment. Tested on NetBSD/amd64, with and without cwrappers, with and without PKGSRC_MKPIE (all four combinations).
Diffstat (limited to 'mk/compiler')
-rw-r--r--mk/compiler/gcc.mk8
1 files changed, 4 insertions, 4 deletions
diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk
index b7dcf859953..d3416828a4b 100644
--- a/mk/compiler/gcc.mk
+++ b/mk/compiler/gcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.182 2017/08/04 08:53:33 jperkin Exp $
+# $NetBSD: gcc.mk,v 1.183 2017/08/25 01:43:17 khorben Exp $
#
# This is the compiler definition for the GNU Compiler Collection.
#
@@ -336,14 +336,14 @@ _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
+_MKPIE_LDFLAGS.gcc= -pie
.endif
.if ${_PKGSRC_MKPIE} == "yes"
_GCC_CFLAGS+= ${_MKPIE_CFLAGS.gcc}
-_GCC_LDFLAGS+= ${_MKPIE_LDFLAGS.gcc}
+#_GCC_LDFLAGS+= ${_MKPIE_LDFLAGS.gcc}
CWRAPPERS_APPEND.cc+= ${_MKPIE_CFLAGS.gcc}
-# XXX this differs for libraries and executables
+# this differs for libraries and executables (handled in mk/cwrappers.mk)
# CWRAPPERS_APPEND.ld+= ${_MKPIE_LDFLAGS.gcc}
.endif