aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2014-06-08 17:29:31 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2014-06-08 17:29:31 +0000
commit864c53ead899f7838cd2e1cca3b485a4a82f5cdc (patch)
tree770fe42f243492477db77896e2564375cd017ad4
parent590d63632198eb31acebf50673f1568c2e8f3fda (diff)
downloadsrc-864c53ead899f7838cd2e1cca3b485a4a82f5cdc.tar.gz
src-864c53ead899f7838cd2e1cca3b485a4a82f5cdc.zip
In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.
This is currently an opt-in build flag. Once ASLR support is ready and stable it should changed to opt-out and be enabled by default along with ASLR. Each application Makefile uses opt-out to ensure that ASLR will be enabled by default in new directories when the system is compiled with PIE/ASLR. [2] Mark known build failures as NO_PIE for now. The only known runtime failure was rtld. [1] http://www.bsdcan.org/2014/schedule/events/452.en.html Submitted by: Shawn Webb <lattera@gmail.com> Discussed between: des@ and Shawn Webb [2]
Notes
Notes: svn path=/head/; revision=267233
-rw-r--r--Makefile.inc16
-rw-r--r--bin/rmail/Makefile2
-rw-r--r--gnu/usr.bin/binutils/addr2line/Makefile2
-rw-r--r--gnu/usr.bin/binutils/nm/Makefile2
-rw-r--r--gnu/usr.bin/binutils/objcopy/Makefile2
-rw-r--r--gnu/usr.bin/binutils/objdump/Makefile2
-rw-r--r--gnu/usr.bin/binutils/readelf/Makefile2
-rw-r--r--gnu/usr.bin/binutils/size/Makefile2
-rw-r--r--gnu/usr.bin/binutils/strings/Makefile2
-rw-r--r--gnu/usr.bin/binutils/strip/Makefile2
-rw-r--r--gnu/usr.bin/gdb/gdb/Makefile2
-rw-r--r--gnu/usr.bin/gdb/gdbtui/Makefile2
-rw-r--r--gnu/usr.bin/gdb/kgdb/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/devices/grodvi/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/devices/grohtml/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/devices/grolbp/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/devices/grolj4/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/devices/grops/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/devices/grotty/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/preproc/eqn/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/preproc/grn/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/preproc/html/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/preproc/pic/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/preproc/refer/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/preproc/soelim/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/preproc/tbl/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/roff/groff/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/roff/troff/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/utils/addftinfo/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/utils/hpftodit/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/utils/indxbib/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/utils/lkbib/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/utils/lookbib/Makefile2
-rw-r--r--gnu/usr.bin/groff/src/utils/tfmtodit/Makefile2
-rw-r--r--gnu/usr.bin/rcs/Makefile.inc1
-rw-r--r--gnu/usr.bin/texinfo/info/Makefile2
-rw-r--r--gnu/usr.bin/texinfo/infokey/Makefile2
-rw-r--r--gnu/usr.bin/texinfo/install-info/Makefile2
-rw-r--r--gnu/usr.bin/texinfo/makeinfo/Makefile2
-rw-r--r--gnu/usr.bin/texinfo/texindex/Makefile2
-rw-r--r--kerberos5/libexec/digest-service/Makefile2
-rw-r--r--kerberos5/libexec/hprop/Makefile2
-rw-r--r--kerberos5/libexec/hpropd/Makefile2
-rw-r--r--kerberos5/libexec/ipropd-master/Makefile2
-rw-r--r--kerberos5/libexec/ipropd-slave/Makefile2
-rw-r--r--kerberos5/libexec/kadmind/Makefile2
-rw-r--r--kerberos5/libexec/kcm/Makefile2
-rw-r--r--kerberos5/libexec/kdc/Makefile2
-rw-r--r--kerberos5/libexec/kdigest/Makefile2
-rw-r--r--kerberos5/libexec/kfd/Makefile2
-rw-r--r--kerberos5/libexec/kimpersonate/Makefile2
-rw-r--r--kerberos5/libexec/kpasswdd/Makefile2
-rw-r--r--kerberos5/tools/asn1_compile/Makefile2
-rw-r--r--kerberos5/tools/slc/Makefile2
-rw-r--r--kerberos5/usr.bin/hxtool/Makefile2
-rw-r--r--kerberos5/usr.bin/kadmin/Makefile2
-rw-r--r--kerberos5/usr.bin/kcc/Makefile2
-rw-r--r--kerberos5/usr.bin/kdestroy/Makefile2
-rw-r--r--kerberos5/usr.bin/kf/Makefile2
-rw-r--r--kerberos5/usr.bin/kgetcred/Makefile2
-rw-r--r--kerberos5/usr.bin/kinit/Makefile2
-rw-r--r--kerberos5/usr.bin/kpasswd/Makefile2
-rw-r--r--kerberos5/usr.bin/ksu/Makefile2
-rw-r--r--kerberos5/usr.bin/string2key/Makefile2
-rw-r--r--kerberos5/usr.bin/verify_krb5_conf/Makefile2
-rw-r--r--kerberos5/usr.sbin/iprop-log/Makefile2
-rw-r--r--kerberos5/usr.sbin/kstash/Makefile2
-rw-r--r--kerberos5/usr.sbin/ktutil/Makefile2
-rw-r--r--lib/csu/amd64/Makefile2
-rw-r--r--lib/csu/i386-elf/Makefile2
-rw-r--r--libexec/mail.local/Makefile2
-rw-r--r--libexec/rtld-elf/Makefile2
-rw-r--r--libexec/smrsh/Makefile2
-rw-r--r--libexec/telnetd/Makefile2
-rw-r--r--sbin/fsck/Makefile2
-rw-r--r--sbin/ipf/ipf/Makefile2
-rw-r--r--sbin/ipf/ipfstat/Makefile2
-rw-r--r--sbin/ipf/ipftest/Makefile2
-rw-r--r--sbin/ipf/ipmon/Makefile2
-rw-r--r--sbin/ipf/ipnat/Makefile2
-rw-r--r--sbin/ipf/ippool/Makefile2
-rw-r--r--sbin/ipf/ipresend/Makefile2
-rw-r--r--sbin/rcorder/Makefile2
-rw-r--r--share/mk/bsd.opts.mk3
-rw-r--r--share/mk/bsd.prog.mk12
-rw-r--r--sys/boot/i386/boot2/Makefile2
-rw-r--r--sys/boot/i386/btx/btx/Makefile2
-rw-r--r--sys/boot/i386/btx/btxldr/Makefile2
-rw-r--r--sys/boot/i386/btx/lib/Makefile2
-rw-r--r--sys/boot/i386/loader/Makefile2
-rw-r--r--sys/boot/mips/beri/boot2/Makefile2
-rw-r--r--sys/boot/mips/beri/loader/Makefile2
-rw-r--r--sys/boot/pc98/boot2/Makefile2
-rw-r--r--sys/boot/pc98/btx/lib/Makefile2
-rw-r--r--sys/boot/pc98/loader/Makefile2
-rw-r--r--sys/boot/sparc64/boot1/Makefile2
-rw-r--r--sys/boot/sparc64/loader/Makefile2
-rw-r--r--tools/build/options/WITH_PIE2
-rw-r--r--usr.bin/clang/clang-tblgen/Makefile2
-rw-r--r--usr.bin/clang/clang.prog.mk2
-rw-r--r--usr.bin/clang/tblgen/Makefile2
-rw-r--r--usr.bin/compile_et/Makefile2
-rw-r--r--usr.bin/mandoc/Makefile2
-rw-r--r--usr.bin/svn/svn/Makefile2
-rw-r--r--usr.bin/svn/svnadmin/Makefile2
-rw-r--r--usr.bin/svn/svndumpfilter/Makefile2
-rw-r--r--usr.bin/svn/svnlook/Makefile2
-rw-r--r--usr.bin/svn/svnmucc/Makefile2
-rw-r--r--usr.bin/svn/svnrdump/Makefile2
-rw-r--r--usr.bin/svn/svnserve/Makefile2
-rw-r--r--usr.bin/svn/svnsync/Makefile2
-rw-r--r--usr.bin/svn/svnversion/Makefile2
-rw-r--r--usr.bin/telnet/Makefile2
-rw-r--r--usr.bin/vacation/Makefile2
-rw-r--r--usr.sbin/amd/amd/Makefile2
-rw-r--r--usr.sbin/amd/amq/Makefile2
-rw-r--r--usr.sbin/amd/fixmount/Makefile2
-rw-r--r--usr.sbin/amd/fsinfo/Makefile2
-rw-r--r--usr.sbin/amd/hlfsd/Makefile2
-rw-r--r--usr.sbin/amd/mk-amd-map/Makefile2
-rw-r--r--usr.sbin/amd/pawd/Makefile2
-rw-r--r--usr.sbin/amd/wire-test/Makefile2
-rw-r--r--usr.sbin/btxld/Makefile2
-rw-r--r--usr.sbin/cron/cron/Makefile2
-rw-r--r--usr.sbin/cron/crontab/Makefile2
-rw-r--r--usr.sbin/crunch/crunchgen/Makefile2
-rw-r--r--usr.sbin/crunch/crunchide/Makefile2
-rw-r--r--usr.sbin/editmap/Makefile2
-rw-r--r--usr.sbin/fifolog/fifolog_create/Makefile2
-rw-r--r--usr.sbin/fifolog/fifolog_reader/Makefile2
-rw-r--r--usr.sbin/fifolog/fifolog_writer/Makefile2
-rw-r--r--usr.sbin/ftp-proxy/ftp-proxy/Makefile2
-rw-r--r--usr.sbin/lpr/chkprintcap/Makefile2
-rw-r--r--usr.sbin/lpr/lpc/Makefile2
-rw-r--r--usr.sbin/lpr/lpd/Makefile2
-rw-r--r--usr.sbin/lpr/lpq/Makefile2
-rw-r--r--usr.sbin/lpr/lpr/Makefile2
-rw-r--r--usr.sbin/lpr/lprm/Makefile2
-rw-r--r--usr.sbin/lpr/pac/Makefile2
-rw-r--r--usr.sbin/mailstats/Makefile2
-rw-r--r--usr.sbin/makefs/Makefile2
-rw-r--r--usr.sbin/makemap/Makefile2
-rw-r--r--usr.sbin/nmtree/Makefile2
-rw-r--r--usr.sbin/ntp/ntp-keygen/Makefile2
-rw-r--r--usr.sbin/ntp/ntpd/Makefile2
-rw-r--r--usr.sbin/ntp/ntpdate/Makefile2
-rw-r--r--usr.sbin/ntp/ntpdc/Makefile2
-rw-r--r--usr.sbin/ntp/ntpq/Makefile2
-rw-r--r--usr.sbin/ntp/ntptime/Makefile2
-rw-r--r--usr.sbin/praliases/Makefile2
-rw-r--r--usr.sbin/sendmail/Makefile2
151 files changed, 312 insertions, 4 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 09c188ba9f19..c9f41e1491bc 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -245,7 +245,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \
- SSP_CFLAGS= \
+ SSP_CFLAGS= MK_PIE=no \
MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
@@ -257,7 +257,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \
- SSP_CFLAGS= \
+ SSP_CFLAGS= MK_PIE=no \
-DNO_LINT \
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
@@ -275,7 +275,7 @@ KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \
- SSP_CFLAGS= \
+ SSP_CFLAGS= MK_PIE=no \
MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
diff --git a/bin/rmail/Makefile b/bin/rmail/Makefile
index ad788a4745a8..c07c9e19aa32 100644
--- a/bin/rmail/Makefile
+++ b/bin/rmail/Makefile
@@ -14,6 +14,8 @@ MAN= rmail.8
WARNS?= 2
CFLAGS+=-I${SENDMAIL_DIR}/include -I.
+NO_PIE= yes
+
LIBSMDIR= ${.OBJDIR}/../../lib/libsm
LIBSM= ${LIBSMDIR}/libsm.a
diff --git a/gnu/usr.bin/binutils/addr2line/Makefile b/gnu/usr.bin/binutils/addr2line/Makefile
index 2380738fa638..37649fa2e11f 100644
--- a/gnu/usr.bin/binutils/addr2line/Makefile
+++ b/gnu/usr.bin/binutils/addr2line/Makefile
@@ -14,4 +14,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/binutils/nm/Makefile b/gnu/usr.bin/binutils/nm/Makefile
index 4ef2b8fdf65a..5945d25adfc6 100644
--- a/gnu/usr.bin/binutils/nm/Makefile
+++ b/gnu/usr.bin/binutils/nm/Makefile
@@ -15,4 +15,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/binutils/objcopy/Makefile b/gnu/usr.bin/binutils/objcopy/Makefile
index 66d99f4e7538..c23e1e856626 100644
--- a/gnu/usr.bin/binutils/objcopy/Makefile
+++ b/gnu/usr.bin/binutils/objcopy/Makefile
@@ -14,4 +14,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/binutils/objdump/Makefile b/gnu/usr.bin/binutils/objdump/Makefile
index 1a0d04625d1a..fb275ac6a403 100644
--- a/gnu/usr.bin/binutils/objdump/Makefile
+++ b/gnu/usr.bin/binutils/objdump/Makefile
@@ -16,4 +16,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/binutils/readelf/Makefile b/gnu/usr.bin/binutils/readelf/Makefile
index d90c3bcc9cc9..fd3110d06541 100644
--- a/gnu/usr.bin/binutils/readelf/Makefile
+++ b/gnu/usr.bin/binutils/readelf/Makefile
@@ -17,4 +17,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/binutils/size/Makefile b/gnu/usr.bin/binutils/size/Makefile
index c5c19c1908e9..a22e67f22e29 100644
--- a/gnu/usr.bin/binutils/size/Makefile
+++ b/gnu/usr.bin/binutils/size/Makefile
@@ -14,4 +14,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/binutils/strings/Makefile b/gnu/usr.bin/binutils/strings/Makefile
index a432d51ddf65..0ff82eb0ba25 100644
--- a/gnu/usr.bin/binutils/strings/Makefile
+++ b/gnu/usr.bin/binutils/strings/Makefile
@@ -14,4 +14,6 @@ DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/binutils/strip/Makefile b/gnu/usr.bin/binutils/strip/Makefile
index d3cf8c454cdc..6d170673d016 100644
--- a/gnu/usr.bin/binutils/strip/Makefile
+++ b/gnu/usr.bin/binutils/strip/Makefile
@@ -15,4 +15,6 @@ DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
INSTALLFLAGS= -S
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile
index 15eb2eb8f537..23a30729de05 100644
--- a/gnu/usr.bin/gdb/gdb/Makefile
+++ b/gnu/usr.bin/gdb/gdb/Makefile
@@ -14,5 +14,7 @@ LDFLAGS+= -Wl,-E
DPADD= ${GDBLIBS} ${BULIBS} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} ${LIBGNUREGEX}
LDADD= ${GDBLIBS} ${BULIBS} -lm -lreadline -ltermcap -lgnuregex
+NO_PIE= yes
+
.include <bsd.prog.mk>
CFLAGS+= -DDEBUGDIR=\"${DEBUGDIR}\"
diff --git a/gnu/usr.bin/gdb/gdbtui/Makefile b/gnu/usr.bin/gdb/gdbtui/Makefile
index 94dbb4babd52..d3651b488421 100644
--- a/gnu/usr.bin/gdb/gdbtui/Makefile
+++ b/gnu/usr.bin/gdb/gdbtui/Makefile
@@ -15,4 +15,6 @@ LDFLAGS+= -Wl,-E
DPADD= ${GDBLIBS} ${BULIBS} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} ${LIBGNUREGEX}
LDADD= ${GDBLIBS} ${BULIBS} -lm -lreadline -ltermcap -lgnuregex
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/gdb/kgdb/Makefile b/gnu/usr.bin/gdb/kgdb/Makefile
index 30cbf3ca1f9f..9543ad0d3f42 100644
--- a/gnu/usr.bin/gdb/kgdb/Makefile
+++ b/gnu/usr.bin/gdb/kgdb/Makefile
@@ -17,4 +17,6 @@ LDADD= ${GDBLIBS} ${BULIBS} -lkvm${GDB_SUFFIX} -lm -lreadline -ltermcap \
CFLAGS+= -Wl,-export-dynamic
.endif
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/devices/grodvi/Makefile b/gnu/usr.bin/groff/src/devices/grodvi/Makefile
index 37454406520a..7c88f046b1a0 100644
--- a/gnu/usr.bin/groff/src/devices/grodvi/Makefile
+++ b/gnu/usr.bin/groff/src/devices/grodvi/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM}
LDADD= ${LIBDRIVER} ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/devices/grohtml/Makefile b/gnu/usr.bin/groff/src/devices/grohtml/Makefile
index 321f1c87c822..4d303386e2f0 100644
--- a/gnu/usr.bin/groff/src/devices/grohtml/Makefile
+++ b/gnu/usr.bin/groff/src/devices/grohtml/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM}
LDADD= ${LIBDRIVER} ${LIBGROFF} -lm
MAN=
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/devices/grolbp/Makefile b/gnu/usr.bin/groff/src/devices/grolbp/Makefile
index 85a41c169b95..69511e09449b 100644
--- a/gnu/usr.bin/groff/src/devices/grolbp/Makefile
+++ b/gnu/usr.bin/groff/src/devices/grolbp/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM}
LDADD= ${LIBDRIVER} ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/devices/grolj4/Makefile b/gnu/usr.bin/groff/src/devices/grolj4/Makefile
index bb3f9e4f62d3..51a003f09860 100644
--- a/gnu/usr.bin/groff/src/devices/grolj4/Makefile
+++ b/gnu/usr.bin/groff/src/devices/grolj4/Makefile
@@ -7,4 +7,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM}
LDADD= ${LIBDRIVER} ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/devices/grops/Makefile b/gnu/usr.bin/groff/src/devices/grops/Makefile
index 4511f69b152e..4933dbb184e6 100644
--- a/gnu/usr.bin/groff/src/devices/grops/Makefile
+++ b/gnu/usr.bin/groff/src/devices/grops/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM}
LDADD= ${LIBDRIVER} ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/devices/grotty/Makefile b/gnu/usr.bin/groff/src/devices/grotty/Makefile
index d15ee8bf6231..78d6498c8060 100644
--- a/gnu/usr.bin/groff/src/devices/grotty/Makefile
+++ b/gnu/usr.bin/groff/src/devices/grotty/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBDRIVER} ${LIBGROFF} ${LIBM}
LDADD= ${LIBDRIVER} ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/preproc/eqn/Makefile b/gnu/usr.bin/groff/src/preproc/eqn/Makefile
index 80871fee3c89..9e53be6be77f 100644
--- a/gnu/usr.bin/groff/src/preproc/eqn/Makefile
+++ b/gnu/usr.bin/groff/src/preproc/eqn/Makefile
@@ -11,6 +11,8 @@ SCRIPTS= neqn
MAN= eqn.1 neqn.1
CLEANFILES= eqn.cpp eqn_tab.h ${SCRIPTS} ${MAN} y.tab.c y.tab.h
+NO_PIE= yes
+
eqn_tab.h: eqn.cpp
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/preproc/grn/Makefile b/gnu/usr.bin/groff/src/preproc/grn/Makefile
index 58309d2a5eb8..d85927025f81 100644
--- a/gnu/usr.bin/groff/src/preproc/grn/Makefile
+++ b/gnu/usr.bin/groff/src/preproc/grn/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM}
LDADD= ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/preproc/html/Makefile b/gnu/usr.bin/groff/src/preproc/html/Makefile
index d46626b4cbfb..4e82fd15adb5 100644
--- a/gnu/usr.bin/groff/src/preproc/html/Makefile
+++ b/gnu/usr.bin/groff/src/preproc/html/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBGROFF}
LDADD= ${LIBGROFF}
MAN=
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/preproc/pic/Makefile b/gnu/usr.bin/groff/src/preproc/pic/Makefile
index 3b5939c3bff1..2d14d0a7e4a7 100644
--- a/gnu/usr.bin/groff/src/preproc/pic/Makefile
+++ b/gnu/usr.bin/groff/src/preproc/pic/Makefile
@@ -8,6 +8,8 @@ DPADD= ${LIBGROFF} ${LIBM}
LDADD= ${LIBGROFF} -lm
CLEANFILES= ${MAN} pic.cpp pic_tab.h y.tab.c y.tab.h
+NO_PIE= yes
+
pic_tab.h: pic.cpp
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/preproc/refer/Makefile b/gnu/usr.bin/groff/src/preproc/refer/Makefile
index 8a18f6f7987c..ce82c7018d18 100644
--- a/gnu/usr.bin/groff/src/preproc/refer/Makefile
+++ b/gnu/usr.bin/groff/src/preproc/refer/Makefile
@@ -7,4 +7,6 @@ DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM}
LDADD= ${LIBBIB} ${LIBGROFF} -lm
CLEANFILES= label.cpp label_tab.h ${MAN} y.tab.c y.tab.h
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/preproc/soelim/Makefile b/gnu/usr.bin/groff/src/preproc/soelim/Makefile
index 2c68b8005f0a..8567a442a74f 100644
--- a/gnu/usr.bin/groff/src/preproc/soelim/Makefile
+++ b/gnu/usr.bin/groff/src/preproc/soelim/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBGROFF}
LDADD= ${LIBGROFF}
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/preproc/tbl/Makefile b/gnu/usr.bin/groff/src/preproc/tbl/Makefile
index 29e7ac238f89..83bde828d54e 100644
--- a/gnu/usr.bin/groff/src/preproc/tbl/Makefile
+++ b/gnu/usr.bin/groff/src/preproc/tbl/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM}
LDADD= ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/roff/groff/Makefile b/gnu/usr.bin/groff/src/roff/groff/Makefile
index 2ae541bbb502..576507c911d2 100644
--- a/gnu/usr.bin/groff/src/roff/groff/Makefile
+++ b/gnu/usr.bin/groff/src/roff/groff/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM}
LDADD= ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/roff/troff/Makefile b/gnu/usr.bin/groff/src/roff/troff/Makefile
index 802af2b6be09..5c3b83720f26 100644
--- a/gnu/usr.bin/groff/src/roff/troff/Makefile
+++ b/gnu/usr.bin/groff/src/roff/troff/Makefile
@@ -7,6 +7,8 @@ DPADD= ${LIBGROFF} ${LIBM}
LDADD= ${LIBGROFF} -lm
CLEANFILES= majorminor.cpp ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
majorminor.cpp: ${GROFF_DIST}/VERSION ${GROFF_DIST}/REVISION
diff --git a/gnu/usr.bin/groff/src/utils/addftinfo/Makefile b/gnu/usr.bin/groff/src/utils/addftinfo/Makefile
index 26fbb57b9d1c..ea3b7a295558 100644
--- a/gnu/usr.bin/groff/src/utils/addftinfo/Makefile
+++ b/gnu/usr.bin/groff/src/utils/addftinfo/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBGROFF}
LDADD= ${LIBGROFF}
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/utils/hpftodit/Makefile b/gnu/usr.bin/groff/src/utils/hpftodit/Makefile
index 1376702a9a83..512ca1bc7960 100644
--- a/gnu/usr.bin/groff/src/utils/hpftodit/Makefile
+++ b/gnu/usr.bin/groff/src/utils/hpftodit/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM}
LDADD= ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/utils/indxbib/Makefile b/gnu/usr.bin/groff/src/utils/indxbib/Makefile
index b2c59a2cee81..86eb4fba7cc0 100644
--- a/gnu/usr.bin/groff/src/utils/indxbib/Makefile
+++ b/gnu/usr.bin/groff/src/utils/indxbib/Makefile
@@ -6,6 +6,8 @@ DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM}
LDADD= ${LIBBIB} ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
beforeinstall:
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
${DIST_DIR}/eign ${DESTDIR}${SHAREDIR}/dict/
diff --git a/gnu/usr.bin/groff/src/utils/lkbib/Makefile b/gnu/usr.bin/groff/src/utils/lkbib/Makefile
index f30dc56cbb8f..42fbd63e2425 100644
--- a/gnu/usr.bin/groff/src/utils/lkbib/Makefile
+++ b/gnu/usr.bin/groff/src/utils/lkbib/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM}
LDADD= ${LIBBIB} ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/utils/lookbib/Makefile b/gnu/usr.bin/groff/src/utils/lookbib/Makefile
index 18834a7432d3..e2ea17df2ecb 100644
--- a/gnu/usr.bin/groff/src/utils/lookbib/Makefile
+++ b/gnu/usr.bin/groff/src/utils/lookbib/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM}
LDADD= ${LIBBIB} ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile b/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile
index ba3bbc54646f..1b0434fbfd7c 100644
--- a/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile
+++ b/gnu/usr.bin/groff/src/utils/tfmtodit/Makefile
@@ -6,4 +6,6 @@ DPADD= ${LIBGROFF} ${LIBM}
LDADD= ${LIBGROFF} -lm
CLEANFILES= ${MAN}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/rcs/Makefile.inc b/gnu/usr.bin/rcs/Makefile.inc
index a46437ad8c82..912ae7b44e42 100644
--- a/gnu/usr.bin/rcs/Makefile.inc
+++ b/gnu/usr.bin/rcs/Makefile.inc
@@ -1,3 +1,4 @@
# $FreeBSD$
LIBRCS= ${.OBJDIR}/../lib/librcs.a
+NO_PIE= yes
diff --git a/gnu/usr.bin/texinfo/info/Makefile b/gnu/usr.bin/texinfo/info/Makefile
index b4e44ac33a8b..a68a1c6efe3f 100644
--- a/gnu/usr.bin/texinfo/info/Makefile
+++ b/gnu/usr.bin/texinfo/info/Makefile
@@ -13,6 +13,8 @@ CFLAGS+= -DINFODIR=\"${INFODIR}:/usr/local/info:.\"
DPADD= ${LIBTERMCAP} ${LIBTXI}
LDADD= -ltermcap ${LIBTXI}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${TXIDIR}/info ${TXIDIR}/doc
diff --git a/gnu/usr.bin/texinfo/infokey/Makefile b/gnu/usr.bin/texinfo/infokey/Makefile
index 50be00d91405..d42406faa967 100644
--- a/gnu/usr.bin/texinfo/infokey/Makefile
+++ b/gnu/usr.bin/texinfo/infokey/Makefile
@@ -6,6 +6,8 @@ SRCS= infokey.c key.c
DPADD= ${LIBTXI}
LDADD= ${LIBTXI}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${TXIDIR}/info ${TXIDIR}/doc
diff --git a/gnu/usr.bin/texinfo/install-info/Makefile b/gnu/usr.bin/texinfo/install-info/Makefile
index 325c9095b35f..21ab9ea40385 100644
--- a/gnu/usr.bin/texinfo/install-info/Makefile
+++ b/gnu/usr.bin/texinfo/install-info/Makefile
@@ -5,6 +5,8 @@ PROG= install-info
DPADD= ${LIBTXI}
LDADD= ${LIBTXI}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${TXIDIR}/util ${TXIDIR}/doc
diff --git a/gnu/usr.bin/texinfo/makeinfo/Makefile b/gnu/usr.bin/texinfo/makeinfo/Makefile
index 373c326467b4..1c3b77d3efdf 100644
--- a/gnu/usr.bin/texinfo/makeinfo/Makefile
+++ b/gnu/usr.bin/texinfo/makeinfo/Makefile
@@ -8,6 +8,8 @@ SRCS= cmds.c defun.c files.c float.c footnote.c html.c \
DPADD= ${LIBTXI}
LDADD= ${LIBTXI}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: $(TXIDIR)/makeinfo $(TXIDIR)/doc
diff --git a/gnu/usr.bin/texinfo/texindex/Makefile b/gnu/usr.bin/texinfo/texindex/Makefile
index 91c2dfc14e30..796d627dd92c 100644
--- a/gnu/usr.bin/texinfo/texindex/Makefile
+++ b/gnu/usr.bin/texinfo/texindex/Makefile
@@ -5,6 +5,8 @@ PROG= texindex
DPADD= ${LIBTXI}
LDADD= ${LIBTXI}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${TXIDIR}/util ${TXIDIR}/doc
diff --git a/kerberos5/libexec/digest-service/Makefile b/kerberos5/libexec/digest-service/Makefile
index 72f7125fa2f3..937d0bf12afc 100644
--- a/kerberos5/libexec/digest-service/Makefile
+++ b/kerberos5/libexec/digest-service/Makefile
@@ -14,6 +14,8 @@ LDADD= -lhdb -lkdc -lheimipcs -lkrb5 -lroken -lasn1 -lcrypto -lcrypt \
${LIBVERS} -lheimntlm
USEPRIVATELIB= heimipcs
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kdc
diff --git a/kerberos5/libexec/hprop/Makefile b/kerberos5/libexec/hprop/Makefile
index ac1dffa81a65..95b473961de8 100644
--- a/kerberos5/libexec/hprop/Makefile
+++ b/kerberos5/libexec/hprop/Makefile
@@ -16,6 +16,8 @@ LDADD= -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD}
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kdc
diff --git a/kerberos5/libexec/hpropd/Makefile b/kerberos5/libexec/hpropd/Makefile
index e0722bd38640..31a5895a87a2 100644
--- a/kerberos5/libexec/hpropd/Makefile
+++ b/kerberos5/libexec/hpropd/Makefile
@@ -10,6 +10,8 @@ LDADD= -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD}
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kdc
diff --git a/kerberos5/libexec/ipropd-master/Makefile b/kerberos5/libexec/ipropd-master/Makefile
index 99a4f9c3ca30..8dbe31536e3a 100644
--- a/kerberos5/libexec/ipropd-master/Makefile
+++ b/kerberos5/libexec/ipropd-master/Makefile
@@ -11,6 +11,8 @@ LDADD= -lkadm5srv -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD}
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
foo::
echo ${LIBHX509}
diff --git a/kerberos5/libexec/ipropd-slave/Makefile b/kerberos5/libexec/ipropd-slave/Makefile
index 8a72d9e8b2e2..4aa1f2783e3d 100644
--- a/kerberos5/libexec/ipropd-slave/Makefile
+++ b/kerberos5/libexec/ipropd-slave/Makefile
@@ -11,6 +11,8 @@ LDADD= -lkadm5srv -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD}
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/lib/kadm5
diff --git a/kerberos5/libexec/kadmind/Makefile b/kerberos5/libexec/kadmind/Makefile
index f88ac2f1b330..898e429de0d5 100644
--- a/kerberos5/libexec/kadmind/Makefile
+++ b/kerberos5/libexec/kadmind/Makefile
@@ -15,6 +15,8 @@ LDADD= -lkadm5srv -lgssapi -lhdb -lkrb5 -lroken \
-lasn1 ${LIBVERS} -lcrypto -lcrypt ${LDAPLDADD}
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kadmin
diff --git a/kerberos5/libexec/kcm/Makefile b/kerberos5/libexec/kcm/Makefile
index bc84c051831c..003c5104f9c3 100644
--- a/kerberos5/libexec/kcm/Makefile
+++ b/kerberos5/libexec/kcm/Makefile
@@ -26,6 +26,8 @@ LDADD= -lhdb -lkrb5 -lroken -lasn1 -lheimntlm -lheimipcs \
USEPRIVATELIB= heimipcs
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kcm
diff --git a/kerberos5/libexec/kdc/Makefile b/kerberos5/libexec/kdc/Makefile
index 4ca5c3a201b2..b309a257ac63 100644
--- a/kerberos5/libexec/kdc/Makefile
+++ b/kerberos5/libexec/kdc/Makefile
@@ -14,6 +14,8 @@ DPADD= ${LIBKDC} ${LIBHDB} ${LIBKRB5} ${LIBROKEN} ${LIBASN1} \
${LIBCRYPTO} ${LIBCRYPT} ${LIBVERS}
LDADD= -lkdc -lhdb -lkrb5 -lroken -lasn1 -lcrypto -lcrypt ${LIBVERS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kdc
diff --git a/kerberos5/libexec/kdigest/Makefile b/kerberos5/libexec/kdigest/Makefile
index c88e3b990f0f..03f1ddfb5ba4 100644
--- a/kerberos5/libexec/kdigest/Makefile
+++ b/kerberos5/libexec/kdigest/Makefile
@@ -13,6 +13,8 @@ SRCS= kdigest.c \
kdigest-commands.c \
kdigest-commands.h
+NO_PIE= yes
+
kdigest-commands.h: kdigest-commands.in
${SLC} ${.ALLSRC:M*.in}
diff --git a/kerberos5/libexec/kfd/Makefile b/kerberos5/libexec/kfd/Makefile
index f5081f18bed2..130cd45390ac 100644
--- a/kerberos5/libexec/kfd/Makefile
+++ b/kerberos5/libexec/kfd/Makefile
@@ -9,6 +9,8 @@ DPADD= ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \
LDADD= -lkrb5 -lroken -lasn1 -lcrypto -lcrypt \
${LIBVERS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/appl/kf
diff --git a/kerberos5/libexec/kimpersonate/Makefile b/kerberos5/libexec/kimpersonate/Makefile
index 32f97772c9b5..2dfeecbe3b92 100644
--- a/kerberos5/libexec/kimpersonate/Makefile
+++ b/kerberos5/libexec/kimpersonate/Makefile
@@ -11,6 +11,8 @@ DPADD= ${LIBKAFS5} ${LIBKRB5} ${LIBHEIMNTLM} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO}
LDADD= -lkafs5 -lkrb5 -lheimntlm -lroken -lasn1 -lcrypto -lcrypt \
${LIBVERS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kuser
diff --git a/kerberos5/libexec/kpasswdd/Makefile b/kerberos5/libexec/kpasswdd/Makefile
index 22876861edaa..4d3914ca05fe 100644
--- a/kerberos5/libexec/kpasswdd/Makefile
+++ b/kerberos5/libexec/kpasswdd/Makefile
@@ -9,6 +9,8 @@ LDADD= -lkadm5srv -lhdb -lkrb5 -lhx509 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err ${LDAPLDADD}
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kpasswd
diff --git a/kerberos5/tools/asn1_compile/Makefile b/kerberos5/tools/asn1_compile/Makefile
index 88224da89eff..45b04e12f424 100644
--- a/kerberos5/tools/asn1_compile/Makefile
+++ b/kerberos5/tools/asn1_compile/Makefile
@@ -27,6 +27,8 @@ CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/asn1 -I.
CLEANFILES= roken.h lex.c parse.c
+NO_PIE= yes
+
roken.h:
make-roken > ${.TARGET}
diff --git a/kerberos5/tools/slc/Makefile b/kerberos5/tools/slc/Makefile
index 1a26e7cd7959..ee98843c6677 100644
--- a/kerberos5/tools/slc/Makefile
+++ b/kerberos5/tools/slc/Makefile
@@ -14,6 +14,8 @@ CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/sl -I${KRB5DIR}/lib/vers -I.
CLEANFILES= roken.h slc-gram.c slc-lex.c
+NO_PIE= yes
+
roken.h:
${MAKE_ROKEN} > ${.TARGET}
diff --git a/kerberos5/usr.bin/hxtool/Makefile b/kerberos5/usr.bin/hxtool/Makefile
index 3946484b78a1..a51dd7df73d6 100644
--- a/kerberos5/usr.bin/hxtool/Makefile
+++ b/kerberos5/usr.bin/hxtool/Makefile
@@ -10,6 +10,8 @@ DPADD= ${LIBHX509} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT} ${LIBSL} ${LI
LDADD= -lhx509 -lroken -lasn1 -lcrypto -lcrypt ${LIBSL} ${LIBVERS} -ledit
SRCS= hxtool.c hxtool-commands.c hxtool-commands.h
+NO_PIE= yes
+
hxtool-commands.h: hxtool-commands.in
${SLC} ${.ALLSRC:M*.in}
diff --git a/kerberos5/usr.bin/kadmin/Makefile b/kerberos5/usr.bin/kadmin/Makefile
index c04ad360adb5..91b53a2f563b 100644
--- a/kerberos5/usr.bin/kadmin/Makefile
+++ b/kerberos5/usr.bin/kadmin/Makefile
@@ -36,6 +36,8 @@ LDADD= -lkadm5clnt -lkadm5srv -lhdb -lkrb5 -lhx509 \
-ledit -lncurses ${LDAPLDADD}
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
kadmin-commands.h: ${KRB5DIR}/kadmin/kadmin-commands.in
diff --git a/kerberos5/usr.bin/kcc/Makefile b/kerberos5/usr.bin/kcc/Makefile
index 3da43d7a35b2..16487a2362bd 100644
--- a/kerberos5/usr.bin/kcc/Makefile
+++ b/kerberos5/usr.bin/kcc/Makefile
@@ -19,6 +19,8 @@ SRCS= kcc.c \
kswitch.c \
copy_cred_cache.c
+NO_PIE= yes
+
kcc-commands.h: kcc-commands.in
${SLC} ${.ALLSRC:M*.in}
diff --git a/kerberos5/usr.bin/kdestroy/Makefile b/kerberos5/usr.bin/kdestroy/Makefile
index b3946e42fd29..6ec3e9b294a2 100644
--- a/kerberos5/usr.bin/kdestroy/Makefile
+++ b/kerberos5/usr.bin/kdestroy/Makefile
@@ -8,6 +8,8 @@ LDADD= -lkafs5 -lkrb5 -lheimntlm -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt
MAN= kdestroy.1
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kuser
diff --git a/kerberos5/usr.bin/kf/Makefile b/kerberos5/usr.bin/kf/Makefile
index c9d3fceb14f8..024470072197 100644
--- a/kerberos5/usr.bin/kf/Makefile
+++ b/kerberos5/usr.bin/kf/Makefile
@@ -9,6 +9,8 @@ DPADD= ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \
LDADD= -lkrb5 -lroken -lasn1 -lcrypto -lcrypt \
${LIBVERS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/appl/kf
diff --git a/kerberos5/usr.bin/kgetcred/Makefile b/kerberos5/usr.bin/kgetcred/Makefile
index dac38adcc18a..d6ca2fc23ea3 100644
--- a/kerberos5/usr.bin/kgetcred/Makefile
+++ b/kerberos5/usr.bin/kgetcred/Makefile
@@ -6,6 +6,8 @@ CFLAGS+= -I${KRB5DIR}/lib/asn1 \
DPADD= ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT} ${LIBVERS}
LDADD= -lkrb5 -lroken -lasn1 -lcrypto -lcrypt ${LIBVERS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kuser
diff --git a/kerberos5/usr.bin/kinit/Makefile b/kerberos5/usr.bin/kinit/Makefile
index e0229f98079d..cefadf31f4c9 100644
--- a/kerberos5/usr.bin/kinit/Makefile
+++ b/kerberos5/usr.bin/kinit/Makefile
@@ -7,6 +7,8 @@ DPADD= ${LIBKAFS5} ${LIBKRB5} ${LIBHEIMNTLM} ${LIBROKEN} ${LIBVERS} \
LDADD= -lkafs5 -lkrb5 -lheimntlm -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kuser
diff --git a/kerberos5/usr.bin/kpasswd/Makefile b/kerberos5/usr.bin/kpasswd/Makefile
index a9ab1c99ec89..2663892db08b 100644
--- a/kerberos5/usr.bin/kpasswd/Makefile
+++ b/kerberos5/usr.bin/kpasswd/Makefile
@@ -7,6 +7,8 @@ DPADD= ${LIBKRB5} ${LIBHX509} ${LIBROKEN} ${LIBVERS} \
LDADD= -lkrb5 -lhx509 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kpasswd
diff --git a/kerberos5/usr.bin/ksu/Makefile b/kerberos5/usr.bin/ksu/Makefile
index 9e2786577ff8..3f4ba31f6cde 100644
--- a/kerberos5/usr.bin/ksu/Makefile
+++ b/kerberos5/usr.bin/ksu/Makefile
@@ -13,6 +13,8 @@ DPADD= ${LIBKAFS5} ${LIBKRB5} ${LIBHX509} ${LIBROKEN} ${LIBVERS} \
LDADD= -lkafs5 -lkrb5 -lhx509 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/appl/su
diff --git a/kerberos5/usr.bin/string2key/Makefile b/kerberos5/usr.bin/string2key/Makefile
index fc790e24dd88..32797f3212c8 100644
--- a/kerberos5/usr.bin/string2key/Makefile
+++ b/kerberos5/usr.bin/string2key/Makefile
@@ -11,6 +11,8 @@ DPADD= ${LIBHDB} ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBCRYPTO} \
${LIBCRYPT} ${LIBVERS}
LDADD= -lhdb -lkrb5 -lroken -lasn1 -lcrypto -lcrypt ${LIBVERS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kdc
diff --git a/kerberos5/usr.bin/verify_krb5_conf/Makefile b/kerberos5/usr.bin/verify_krb5_conf/Makefile
index 830e66a29115..9968dd6018e6 100644
--- a/kerberos5/usr.bin/verify_krb5_conf/Makefile
+++ b/kerberos5/usr.bin/verify_krb5_conf/Makefile
@@ -8,6 +8,8 @@ DPADD= ${LIBKAFS5} ${LIBKRB5} ${LIBHX509} ${LIBROKEN} ${LIBVERS} \
LDADD= -lkafs5 -lkrb5 -lhx509 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -lcom_err
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/lib/krb5
diff --git a/kerberos5/usr.sbin/iprop-log/Makefile b/kerberos5/usr.sbin/iprop-log/Makefile
index 176012a9e7d9..a5cb4f5e5000 100644
--- a/kerberos5/usr.sbin/iprop-log/Makefile
+++ b/kerberos5/usr.sbin/iprop-log/Makefile
@@ -13,6 +13,8 @@ DPADD= ${LIBKADM5SRV} ${LIBHDB} ${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} \
LDADD= -lkadm5srv -lhdb -lkrb5 -lasn1 -lcrypto -lcrypt ${LIBSL} -lroken \
${LIBVERS} -ledit
+NO_PIE= yes
+
iprop-commands.h: iprop-commands.in
${SLC} ${.ALLSRC:M*.in}
diff --git a/kerberos5/usr.sbin/kstash/Makefile b/kerberos5/usr.sbin/kstash/Makefile
index 024e45dba917..9fc810179639 100644
--- a/kerberos5/usr.sbin/kstash/Makefile
+++ b/kerberos5/usr.sbin/kstash/Makefile
@@ -10,6 +10,8 @@ LDADD= -lhdb -lkrb5 -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt ${LDAPLDADD}
LDFLAGS=${LDAPLDFLAGS}
+NO_PIE= yes
+
.include <bsd.prog.mk>
.PATH: ${KRB5DIR}/kdc
diff --git a/kerberos5/usr.sbin/ktutil/Makefile b/kerberos5/usr.sbin/ktutil/Makefile
index f7d340f78e9a..3445fc69562f 100644
--- a/kerberos5/usr.sbin/ktutil/Makefile
+++ b/kerberos5/usr.sbin/ktutil/Makefile
@@ -22,6 +22,8 @@ DPADD= ${LIBKADM5CLNT} ${LIBKRB5} ${LIBSL} ${LIBROKEN} ${LIBVERS} \
LDADD= -lkadm5clnt -lkrb5 ${LIBSL} -lroken ${LIBVERS} \
-lasn1 -lcrypto -lcrypt -ledit
+NO_PIE= yes
+
.include <bsd.prog.mk>
ktutil-commands.h: ${KRB5DIR}/admin/ktutil-commands.in
diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile
index 80d14a7ae7af..bcb7f508776c 100644
--- a/lib/csu/amd64/Makefile
+++ b/lib/csu/amd64/Makefile
@@ -9,6 +9,8 @@ CFLAGS+= -I${.CURDIR}/../common \
-I${.CURDIR}/../../libc/include
CFLAGS+= -fno-omit-frame-pointer
+NO_PIE= yes
+
all: ${OBJS}
CLEANFILES= ${OBJS}
diff --git a/lib/csu/i386-elf/Makefile b/lib/csu/i386-elf/Makefile
index 286c15cb9055..de19e93d0890 100644
--- a/lib/csu/i386-elf/Makefile
+++ b/lib/csu/i386-elf/Makefile
@@ -13,6 +13,8 @@ CFLAGS+= -I${.CURDIR}/../common \
CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s
+NO_PIE= yes
+
# See the comment in lib/csu/common/crtbrand.c for the reason crt1_c.c is not
# directly compiled to .o files.
diff --git a/libexec/mail.local/Makefile b/libexec/mail.local/Makefile
index 3e59609e893e..dff4238aebf6 100644
--- a/libexec/mail.local/Makefile
+++ b/libexec/mail.local/Makefile
@@ -9,6 +9,8 @@ SRCS= mail.local.c
MAN= mail.local.8
CFLAGS+=-I${SENDMAIL_DIR}/include -I.
+NO_PIE= yes
+
WARNS?= 2
WFORMAT=0
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index 21e2219d3727..ba13778f4ef9 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -78,5 +78,7 @@ beforeinstall:
.PATH: ${.CURDIR}/${RTLD_ARCH}
+NO_PIE= yes
+
.include <bsd.symver.mk>
.include <bsd.prog.mk>
diff --git a/libexec/smrsh/Makefile b/libexec/smrsh/Makefile
index ae86155d0d00..9f0bfd454edc 100644
--- a/libexec/smrsh/Makefile
+++ b/libexec/smrsh/Makefile
@@ -9,6 +9,8 @@ SRCS= smrsh.c
MAN= smrsh.8
CFLAGS+=-I${SENDMAIL_DIR}/src -I${SENDMAIL_DIR}/include -I.
+NO_PIE= yes
+
LIBSMDIR= ${.OBJDIR}/../../lib/libsm
LIBSM= ${LIBSMDIR}/libsm.a
diff --git a/libexec/telnetd/Makefile b/libexec/telnetd/Makefile
index 4300d0dd9254..a63b937231e5 100644
--- a/libexec/telnetd/Makefile
+++ b/libexec/telnetd/Makefile
@@ -20,6 +20,8 @@ WFORMAT?= 0
CFLAGS+= -DLINEMODE -DUSE_TERMIO -DDIAGNOSTICS -DOLD_ENVIRON \
-DENV_HACK -DSTREAMSPTY
+NO_PIE= yes
+
.if ${MK_INET6_SUPPORT} != "no"
CFLAGS+= -DINET6
.endif
diff --git a/sbin/fsck/Makefile b/sbin/fsck/Makefile
index 22de03c4da78..d0c45dbfd797 100644
--- a/sbin/fsck/Makefile
+++ b/sbin/fsck/Makefile
@@ -5,4 +5,6 @@ PROG= fsck
SRCS= fsck.c fsutil.c preen.c
MAN= fsck.8
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/sbin/ipf/ipf/Makefile b/sbin/ipf/ipf/Makefile
index c3938c63af61..73888b29ba6f 100644
--- a/sbin/ipf/ipf/Makefile
+++ b/sbin/ipf/ipf/Makefile
@@ -39,4 +39,6 @@ DPADD+= ${LIBPCAP}
LDADD+= -lpcap
.endif
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/sbin/ipf/ipfstat/Makefile b/sbin/ipf/ipfstat/Makefile
index a33c5df38d8f..c2b422df42f4 100644
--- a/sbin/ipf/ipfstat/Makefile
+++ b/sbin/ipf/ipfstat/Makefile
@@ -8,4 +8,6 @@ MAN= ipfstat.8
DPADD+= ${LIBCURSES}
LDADD+= -lcurses
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/sbin/ipf/ipftest/Makefile b/sbin/ipf/ipftest/Makefile
index 32b074cb93f4..57f3c4e7de83 100644
--- a/sbin/ipf/ipftest/Makefile
+++ b/sbin/ipf/ipftest/Makefile
@@ -32,6 +32,8 @@ CLEANFILES+= ipnat.tab.c ipnat.tab.h
CLEANFILES+= ippool_y.c ippool_l.c
CLEANFILES+= ippool.tab.c ippool.tab.h
+NO_PIE= yes
+
ipnat_y.c: ipnat_y.y
${YACC} -b ipnat -d ${.ALLSRC}
sed -e 's/yy/ipnat_yy/g' \
diff --git a/sbin/ipf/ipmon/Makefile b/sbin/ipf/ipmon/Makefile
index 3639f8733c1e..2ecfed1aa1b8 100644
--- a/sbin/ipf/ipmon/Makefile
+++ b/sbin/ipf/ipmon/Makefile
@@ -11,6 +11,8 @@ DPSRCS+= ${GENHDRS}
CLEANFILES+= ${GENHDRS} ipmon_y.c ipmon_l.c
+NO_PIE= yes
+
ipmon_y.c: ipmon_y.y
${YACC} -d ${.ALLSRC}
sed -e 's/yy/ipmon_yy/g' \
diff --git a/sbin/ipf/ipnat/Makefile b/sbin/ipf/ipnat/Makefile
index 1c017e182cb1..aafb0147ec57 100644
--- a/sbin/ipf/ipnat/Makefile
+++ b/sbin/ipf/ipnat/Makefile
@@ -11,6 +11,8 @@ DPSRCS+= ${GENHDRS}
CLEANFILES+= ${GENHDRS} ipnat_y.c ipnat_l.c
+NO_PIE= yes
+
ipnat_y.c: ipnat_y.y
${YACC} -d ${.ALLSRC}
sed -e 's/yy/ipnat_yy/g' \
diff --git a/sbin/ipf/ippool/Makefile b/sbin/ipf/ippool/Makefile
index 6e3f85da847d..bb7e9ceb24b9 100644
--- a/sbin/ipf/ippool/Makefile
+++ b/sbin/ipf/ippool/Makefile
@@ -10,6 +10,8 @@ DPSRCS+= ${GENHDRS}
CLEANFILES+= ${GENHDRS} ippool_y.c ippool_l.c
+NO_PIE= yes
+
ippool_y.c: ippool_y.y
${YACC} -d ${.ALLSRC}
sed -e 's/yy/ippool_yy/g' \
diff --git a/sbin/ipf/ipresend/Makefile b/sbin/ipf/ipresend/Makefile
index 5e0ac15cbb1f..492451cebfc2 100644
--- a/sbin/ipf/ipresend/Makefile
+++ b/sbin/ipf/ipresend/Makefile
@@ -4,6 +4,8 @@ PROG= ipresend
SRCS= ipresend.c ip.c resend.c sbpf.c sock.c 44arp.c
MAN= ipresend.1
+NO_PIE= yes
+
.PATH: ${.CURDIR}/../../../contrib/ipfilter/ipsend
.include <bsd.prog.mk>
diff --git a/sbin/rcorder/Makefile b/sbin/rcorder/Makefile
index b71aa4b83d37..dc48b4cae918 100644
--- a/sbin/rcorder/Makefile
+++ b/sbin/rcorder/Makefile
@@ -14,6 +14,8 @@ CFLAGS+= -DORDER -I.
SRCS+= util.h
CLEANFILES+= util.h
+NO_PIE= yes
+
util.h:
ln -sf ${.CURDIR}/../../lib/libutil/libutil.h ${.TARGET}
diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk
index 51d6c039376f..6b5ad51c5434 100644
--- a/share/mk/bsd.opts.mk
+++ b/share/mk/bsd.opts.mk
@@ -68,7 +68,8 @@ __DEFAULT_YES_OPTIONS = \
__DEFAULT_NO_OPTIONS = \
CTF \
DEBUG_FILES \
- INSTALL_AS_USER
+ INSTALL_AS_USER \
+ PIE
.include <bsd.mkopt.mk>
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index fd35e0323028..229ce8e1fe64 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -11,6 +11,18 @@
CFLAGS+=${COPTS}
.endif
+.if ${MK_PIE} != "no" && (!defined(NO_PIE) || ${NO_PIE} == "no")
+.if !defined(RESCUE) && !defined(NO_SHARED)
+CFLAGS+= -fPIE -pie
+LDFLAGS+= -pie
+.elif defined(NO_SHARED)
+.if ${NO_SHARED} == "no" || ${NO_SHARED} == "NO"
+CFLAGS+= -fPIE -pie
+LDFLAGS+= -pie
+.endif
+.endif
+.endif
+
.if ${MK_ASSERT_DEBUG} == "no"
CFLAGS+= -DNDEBUG
NO_WERROR=
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
index fa8c29d33a88..e52060d0679f 100644
--- a/sys/boot/i386/boot2/Makefile
+++ b/sys/boot/i386/boot2/Makefile
@@ -22,6 +22,8 @@ BOOT2_UFS?= UFS1_AND_UFS2
#BOOT2_UFS?= UFS2_ONLY
#BOOT2_UFS?= UFS1_ONLY
+NO_PIE= yes
+
CFLAGS= -Os \
-fomit-frame-pointer \
-mrtd \
diff --git a/sys/boot/i386/btx/btx/Makefile b/sys/boot/i386/btx/btx/Makefile
index 0f5a468ba62e..55756e0fa089 100644
--- a/sys/boot/i386/btx/btx/Makefile
+++ b/sys/boot/i386/btx/btx/Makefile
@@ -5,6 +5,8 @@ INTERNALPROG=
MAN=
SRCS= btx.S
+NO_PIE= yes
+
.if defined(BOOT_BTX_NOHANG)
BOOT_BTX_FLAGS=0x1
.else
diff --git a/sys/boot/i386/btx/btxldr/Makefile b/sys/boot/i386/btx/btxldr/Makefile
index 7e57ca3fc6a2..68089346ded3 100644
--- a/sys/boot/i386/btx/btxldr/Makefile
+++ b/sys/boot/i386/btx/btxldr/Makefile
@@ -5,6 +5,8 @@ INTERNALPROG=
MAN=
SRCS= btxldr.S
+NO_PIE= yes
+
CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS}
CFLAGS+=-I${.CURDIR}/../../common
diff --git a/sys/boot/i386/btx/lib/Makefile b/sys/boot/i386/btx/lib/Makefile
index c66f0fcc5169..caec3eb68210 100644
--- a/sys/boot/i386/btx/lib/Makefile
+++ b/sys/boot/i386/btx/lib/Makefile
@@ -7,4 +7,6 @@ SRCS= btxcsu.S btxsys.s btxv86.s
CFLAGS+=-I${.CURDIR}/../../common
LDFLAGS=-Wl,-r
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile
index b33101283b49..7de6176f63da 100644
--- a/sys/boot/i386/loader/Makefile
+++ b/sys/boot/i386/loader/Makefile
@@ -8,6 +8,8 @@ PROG= ${LOADER}.sym
INTERNALPROG=
NEWVERSWHAT?= "bootstrap loader" x86
+NO_PIE= yes
+
# architecture-specific loader code
SRCS= main.c conf.c vers.c
diff --git a/sys/boot/mips/beri/boot2/Makefile b/sys/boot/mips/beri/boot2/Makefile
index 325edbcdbe5f..71953949c9d2 100644
--- a/sys/boot/mips/beri/boot2/Makefile
+++ b/sys/boot/mips/beri/boot2/Makefile
@@ -32,6 +32,8 @@
BINDIR?= /boot
INSTALLFLAGS= -b
+NO_PIE= yes
+
LOADERS= flashboot jtagboot
FILES= ${LOADERS} ${LOADERS:S/$/.md5/}
diff --git a/sys/boot/mips/beri/loader/Makefile b/sys/boot/mips/beri/loader/Makefile
index 3da7f7f274b3..3a751894f65c 100644
--- a/sys/boot/mips/beri/loader/Makefile
+++ b/sys/boot/mips/beri/loader/Makefile
@@ -36,6 +36,8 @@ PROG?= loader
NEWVERSWHAT= "BERI loader" ${MACHINE_CPUARCH}
INSTALLFLAGS= -b
+NO_PIE= yes
+
# Architecture-specific loader code
SRCS= start.S \
main.c \
diff --git a/sys/boot/pc98/boot2/Makefile b/sys/boot/pc98/boot2/Makefile
index 88076a8e5af9..00037cb60ee7 100644
--- a/sys/boot/pc98/boot2/Makefile
+++ b/sys/boot/pc98/boot2/Makefile
@@ -6,6 +6,8 @@
CC:= gcc
COMPILER_TYPE:= gcc
+NO_PIE= yes
+
FILES= boot boot1 boot2
NM?= nm
diff --git a/sys/boot/pc98/btx/lib/Makefile b/sys/boot/pc98/btx/lib/Makefile
index e5876bc1371d..9e2b8c6f5d12 100644
--- a/sys/boot/pc98/btx/lib/Makefile
+++ b/sys/boot/pc98/btx/lib/Makefile
@@ -7,4 +7,6 @@ SRCS= btxcsu.S btxsys.s btxv86.s
CFLAGS+=-I${.CURDIR}/../../../i386/common
LDFLAGS=-Wl,-r
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/sys/boot/pc98/loader/Makefile b/sys/boot/pc98/loader/Makefile
index 7ab13a189dd3..f18db055f546 100644
--- a/sys/boot/pc98/loader/Makefile
+++ b/sys/boot/pc98/loader/Makefile
@@ -8,6 +8,8 @@ PROG= ${LOADER}.sym
INTERNALPROG=
NEWVERSWHAT= "bootstrap loader" pc98
+NO_PIE= yes
+
# architecture-specific loader code
SRCS= main.c conf.c vers.c
.PATH: ${.CURDIR}/../../i386/loader
diff --git a/sys/boot/sparc64/boot1/Makefile b/sys/boot/sparc64/boot1/Makefile
index 5150c3b5f85b..c867a6162943 100644
--- a/sys/boot/sparc64/boot1/Makefile
+++ b/sys/boot/sparc64/boot1/Makefile
@@ -7,6 +7,8 @@ FILES?= boot1
SRCS= _start.s boot1.c
CLEANFILES=${FILES} boot1.aout
+NO_PIE= yes
+
BOOTBLOCKBASE= 0x4000
CFLAGS.clang+=-mcmodel=small
diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile
index d7266ad08781..00c37dc4095e 100644
--- a/sys/boot/sparc64/loader/Makefile
+++ b/sys/boot/sparc64/loader/Makefile
@@ -7,6 +7,8 @@ PROG?= loader
NEWVERSWHAT?= "bootstrap loader" sparc64
INSTALLFLAGS= -b
+NO_PIE= yes
+
# Architecture-specific loader code
SRCS= locore.S main.c metadata.c vers.c
diff --git a/tools/build/options/WITH_PIE b/tools/build/options/WITH_PIE
new file mode 100644
index 000000000000..509da18f901f
--- /dev/null
+++ b/tools/build/options/WITH_PIE
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Enable building of Position-Independent Executables (PIEs).
diff --git a/usr.bin/clang/clang-tblgen/Makefile b/usr.bin/clang/clang-tblgen/Makefile
index 0f64ad373789..34e7aebec318 100644
--- a/usr.bin/clang/clang-tblgen/Makefile
+++ b/usr.bin/clang/clang-tblgen/Makefile
@@ -19,4 +19,6 @@ SRCS= ClangASTNodesEmitter.cpp \
LIBDEPS=llvmtablegen \
llvmsupport
+NO_PIE= yes
+
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk
index 4cd1052d7de3..5f8f7a9af28b 100644
--- a/usr.bin/clang/clang.prog.mk
+++ b/usr.bin/clang/clang.prog.mk
@@ -1,5 +1,7 @@
# $FreeBSD$
+NO_PIE= yes
+
LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm
.include "../../lib/clang/clang.build.mk"
diff --git a/usr.bin/clang/tblgen/Makefile b/usr.bin/clang/tblgen/Makefile
index f06150e90562..31fdc2091537 100644
--- a/usr.bin/clang/tblgen/Makefile
+++ b/usr.bin/clang/tblgen/Makefile
@@ -42,4 +42,6 @@ SRCS= AsmMatcherEmitter.cpp \
LIBDEPS=llvmtablegen \
llvmsupport
+NO_PIE= yes
+
.include "../clang.prog.mk"
diff --git a/usr.bin/compile_et/Makefile b/usr.bin/compile_et/Makefile
index d7177b2f16fd..122d745b3cb2 100644
--- a/usr.bin/compile_et/Makefile
+++ b/usr.bin/compile_et/Makefile
@@ -12,4 +12,6 @@ CFLAGS+=-I. -I${.CURDIR}/../../contrib/com_err
WARNS?= 0
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile
index ed88f4e7b70d..eb50978a89ee 100644
--- a/usr.bin/mandoc/Makefile
+++ b/usr.bin/mandoc/Makefile
@@ -19,4 +19,6 @@ CFLAGS+= -DHAVE_CONFIG_H
DPADD= ${LIBMANDOC}
LDADD= ${LIBMANDOC}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svn/Makefile b/usr.bin/svn/svn/Makefile
index dfa2e384f116..bb823c718c9b 100644
--- a/usr.bin/svn/svn/Makefile
+++ b/usr.bin/svn/svn/Makefile
@@ -8,6 +8,8 @@ MAN=
PROG= svn${SVNLITE}
+NO_PIE= yes
+
SRCS= add-cmd.c blame-cmd.c cat-cmd.c changelist-cmd.c checkout-cmd.c \
cl-conflicts.c cleanup-cmd.c commit-cmd.c conflict-callbacks.c \
copy-cmd.c delete-cmd.c deprecated.c diff-cmd.c export-cmd.c \
diff --git a/usr.bin/svn/svnadmin/Makefile b/usr.bin/svn/svnadmin/Makefile
index 3220cdef3e4a..c173d3ba9710 100644
--- a/usr.bin/svn/svnadmin/Makefile
+++ b/usr.bin/svn/svnadmin/Makefile
@@ -34,4 +34,6 @@ DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svndumpfilter/Makefile b/usr.bin/svn/svndumpfilter/Makefile
index 864f3767913d..67467350cd09 100644
--- a/usr.bin/svn/svndumpfilter/Makefile
+++ b/usr.bin/svn/svndumpfilter/Makefile
@@ -34,4 +34,6 @@ DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnlook/Makefile b/usr.bin/svn/svnlook/Makefile
index 3d8b1a036c13..209b2f1b0006 100644
--- a/usr.bin/svn/svnlook/Makefile
+++ b/usr.bin/svn/svnlook/Makefile
@@ -35,4 +35,6 @@ DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
${LIBSVN_DELTA} ${LIBSVN_DIFF} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnmucc/Makefile b/usr.bin/svn/svnmucc/Makefile
index 23a98e30ffc3..34e706e8073c 100644
--- a/usr.bin/svn/svnmucc/Makefile
+++ b/usr.bin/svn/svnmucc/Makefile
@@ -42,4 +42,6 @@ DPADD= ${LIBSVN_CLIENT} ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} \
${LIBAPR_UTIL} ${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} \
${LIBCRYPT} ${LIBMAGIC} ${LIBCRYPTO} ${LIBSSL} ${LIBPTHREAD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnrdump/Makefile b/usr.bin/svn/svnrdump/Makefile
index afeae003c994..8a6a8fdcd602 100644
--- a/usr.bin/svn/svnrdump/Makefile
+++ b/usr.bin/svn/svnrdump/Makefile
@@ -45,4 +45,6 @@ DPADD= ${LIBSVN_CLIENT} ${LIBSVN_WC} ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT} ${LIBMAGIC} \
${LIBCRYPTO} ${LIBSSL} ${LIBPTHREAD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnserve/Makefile b/usr.bin/svn/svnserve/Makefile
index f1fa314e1628..d21883c5e94c 100644
--- a/usr.bin/svn/svnserve/Makefile
+++ b/usr.bin/svn/svnserve/Makefile
@@ -41,4 +41,6 @@ DPADD= ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT} ${LIBMAGIC} \
${LIBCRYPTO} ${LIBSSL} ${LIBPTHREAD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnsync/Makefile b/usr.bin/svn/svnsync/Makefile
index a8cd3802ad53..db479c418128 100644
--- a/usr.bin/svn/svnsync/Makefile
+++ b/usr.bin/svn/svnsync/Makefile
@@ -41,4 +41,6 @@ DPADD= ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT} ${LIBMAGIC} \
${LIBCRYPTO} ${LIBSSL} ${LIBPTHREAD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnversion/Makefile b/usr.bin/svn/svnversion/Makefile
index ca28ec312126..54ce13c39a07 100644
--- a/usr.bin/svn/svnversion/Makefile
+++ b/usr.bin/svn/svnversion/Makefile
@@ -32,4 +32,6 @@ DPADD= ${LIBSVN_WC} ${LIBSVN_DELTA} ${LIBSVN_DIFF} ${LIBSVN_SUBR} \
${LIBSERF} ${LIBAPR_UTIL} ${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} \
${LIBZ} ${LIBCRYPT}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/telnet/Makefile b/usr.bin/telnet/Makefile
index adee9dc134f3..295223742823 100644
--- a/usr.bin/telnet/Makefile
+++ b/usr.bin/telnet/Makefile
@@ -13,6 +13,8 @@ SRCS= commands.c main.c network.c ring.c sys_bsd.c \
CFLAGS+= -DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK -DOPIE \
-I${TELNETDIR} -I${TELNETDIR}/libtelnet/
+NO_PIE= yes
+
.if ${MK_INET6_SUPPORT} != "no"
CFLAGS+= -DINET6
.endif
diff --git a/usr.bin/vacation/Makefile b/usr.bin/vacation/Makefile
index 056f5764fa01..4f8690cf2605 100644
--- a/usr.bin/vacation/Makefile
+++ b/usr.bin/vacation/Makefile
@@ -32,6 +32,8 @@ DPADD+=${SENDMAIL_DPADD}
LDADD+=${SENDMAIL_LDADD}
LDFLAGS+=${SENDMAIL_LDFLAGS}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/amd/amd/Makefile b/usr.sbin/amd/amd/Makefile
index 1fc41bfe20d0..fdcbd601e5c9 100644
--- a/usr.sbin/amd/amd/Makefile
+++ b/usr.sbin/amd/amd/Makefile
@@ -24,6 +24,8 @@ SRCS+= ops_nullfs.c ops_pcfs.c ops_tfs.c ops_ufs.c ops_umapfs.c
SRCS+= ops_unionfs.c opts.c readdir.c restart.c rpc_fwd.c sched.c
SRCS+= srvr_amfs_auto.c srvr_nfs.c
+NO_PIE= yes
+
CFLAGS+= -I${.CURDIR}/../../../contrib/amd/amd \
-I${DESTDIR}/usr/include/rpcsvc
diff --git a/usr.sbin/amd/amq/Makefile b/usr.sbin/amd/amq/Makefile
index 74fc7492f524..40257c308b98 100644
--- a/usr.sbin/amd/amq/Makefile
+++ b/usr.sbin/amd/amq/Makefile
@@ -17,4 +17,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/amd/amq
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/fixmount/Makefile b/usr.sbin/amd/fixmount/Makefile
index 7f96a456dfe4..1838fb29ba33 100644
--- a/usr.sbin/amd/fixmount/Makefile
+++ b/usr.sbin/amd/fixmount/Makefile
@@ -18,4 +18,6 @@ SRCS+= checkmount_bsd44.c
DPADD= ${LIBAMU} ${LIBRPCSVC}
LDADD= ${LIBAMU} -lrpcsvc
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/fsinfo/Makefile b/usr.sbin/amd/fsinfo/Makefile
index 1695a469f980..83becb2c5b3d 100644
--- a/usr.sbin/amd/fsinfo/Makefile
+++ b/usr.sbin/amd/fsinfo/Makefile
@@ -13,6 +13,8 @@ SRCS= fsi_gram.y fsi_lex.l
SRCS+= fsi_analyze.c fsi_dict.c fsi_util.c fsinfo.c wr_atab.c
SRCS+= wr_bparam.c wr_dumpset.c wr_exportfs.c wr_fstab.c
+NO_PIE= yes
+
CFLAGS+= -I${.CURDIR}/../../../contrib/amd/fsinfo
DPADD= ${LIBAMU}
diff --git a/usr.sbin/amd/hlfsd/Makefile b/usr.sbin/amd/hlfsd/Makefile
index 5b863dd5adcd..dca94da6bb95 100644
--- a/usr.sbin/amd/hlfsd/Makefile
+++ b/usr.sbin/amd/hlfsd/Makefile
@@ -16,4 +16,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/amd/hlfsd
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/mk-amd-map/Makefile b/usr.sbin/amd/mk-amd-map/Makefile
index 57fd6a5f0bdc..bed9e30c9b91 100644
--- a/usr.sbin/amd/mk-amd-map/Makefile
+++ b/usr.sbin/amd/mk-amd-map/Makefile
@@ -13,4 +13,6 @@ MAN= mk-amd-map.8
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/pawd/Makefile b/usr.sbin/amd/pawd/Makefile
index c6bb1cc37a0b..612acedf7a8a 100644
--- a/usr.sbin/amd/pawd/Makefile
+++ b/usr.sbin/amd/pawd/Makefile
@@ -17,4 +17,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/amd/amq
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/amd/wire-test/Makefile b/usr.sbin/amd/wire-test/Makefile
index a07e6902fe76..f96076863735 100644
--- a/usr.sbin/amd/wire-test/Makefile
+++ b/usr.sbin/amd/wire-test/Makefile
@@ -13,4 +13,6 @@ MAN= wire-test.8
DPADD= ${LIBAMU}
LDADD= ${LIBAMU}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/btxld/Makefile b/usr.sbin/btxld/Makefile
index 32cf99d5edac..8df8fa1c39fe 100644
--- a/usr.sbin/btxld/Makefile
+++ b/usr.sbin/btxld/Makefile
@@ -4,4 +4,6 @@ PROG= btxld
MAN= btxld.8
SRCS= btxld.c elfh.c
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/cron/cron/Makefile b/usr.sbin/cron/cron/Makefile
index d9a1d247d41e..c7762f180b64 100644
--- a/usr.sbin/cron/cron/Makefile
+++ b/usr.sbin/cron/cron/Makefile
@@ -11,4 +11,6 @@ LDADD= ${LIBCRON} ${MINUSLPAM} -lutil
WARNS?= 2
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/cron/crontab/Makefile b/usr.sbin/cron/crontab/Makefile
index 829128e5729e..cd9600ae8184 100644
--- a/usr.sbin/cron/crontab/Makefile
+++ b/usr.sbin/cron/crontab/Makefile
@@ -15,4 +15,6 @@ CFLAGS+= -I${.CURDIR}/../cron
DPADD= ${LIBCRON} ${LIBMD} ${LIBUTIL}
LDADD= ${LIBCRON} -lmd -lutil
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/crunch/crunchgen/Makefile b/usr.sbin/crunch/crunchgen/Makefile
index 8d0a78b19027..7b07f2bd2a2a 100644
--- a/usr.sbin/crunch/crunchgen/Makefile
+++ b/usr.sbin/crunch/crunchgen/Makefile
@@ -4,6 +4,8 @@ PROG= crunchgen
SRCS= crunchgen.c crunched_skel.c
CLEANFILES+= crunched_skel.c
+NO_PIE= yes
+
crunched_skel.c: crunched_main.c
sh -e ${.CURDIR}/mkskel.sh ${.CURDIR}/crunched_main.c >crunched_skel.c
diff --git a/usr.sbin/crunch/crunchide/Makefile b/usr.sbin/crunch/crunchide/Makefile
index 2a6c50068d7f..c959a3e1b9b3 100644
--- a/usr.sbin/crunch/crunchide/Makefile
+++ b/usr.sbin/crunch/crunchide/Makefile
@@ -3,6 +3,8 @@
PROG= crunchide
SRCS= crunchide.c
+NO_PIE= yes
+
TARGET_ARCH?= ${MACHINE_ARCH}
.if ${TARGET_ARCH} == i386 && ${MACHINE_ARCH} == i386
diff --git a/usr.sbin/editmap/Makefile b/usr.sbin/editmap/Makefile
index 92d8392bf1f8..8b4562cf1163 100644
--- a/usr.sbin/editmap/Makefile
+++ b/usr.sbin/editmap/Makefile
@@ -33,6 +33,8 @@ DPADD+=${SENDMAIL_DPADD}
LDADD+=${SENDMAIL_LDADD}
LDFLAGS+=${SENDMAIL_LDFLAGS}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/fifolog/fifolog_create/Makefile b/usr.sbin/fifolog/fifolog_create/Makefile
index 8b59b25ed251..38a66233d35b 100644
--- a/usr.sbin/fifolog/fifolog_create/Makefile
+++ b/usr.sbin/fifolog/fifolog_create/Makefile
@@ -12,6 +12,8 @@ MLINKS= fifolog.1 fifolog_create.1 \
fifolog.1 fifolog_reader.1 \
fifolog.1 fifolog_writer.1
+NO_PIE= yes
+
regress:
rm -f /tmp/fifolog.?
./${PROG} /tmp/fifolog.0
diff --git a/usr.sbin/fifolog/fifolog_reader/Makefile b/usr.sbin/fifolog/fifolog_reader/Makefile
index c88f10e95295..dfbb73f0ce3c 100644
--- a/usr.sbin/fifolog/fifolog_reader/Makefile
+++ b/usr.sbin/fifolog/fifolog_reader/Makefile
@@ -9,6 +9,8 @@ MAN=
DPADD= ${LIBFIFOLOG} ${LIBUTIL} ${LIBZ}
LDADD= ${LIBFIFOLOG} -lutil -lz
+NO_PIE= yes
+
regress:
./${PROG} /tmp/fifolog.0
./${PROG} -t /tmp/fifolog.0
diff --git a/usr.sbin/fifolog/fifolog_writer/Makefile b/usr.sbin/fifolog/fifolog_writer/Makefile
index 9d802c7eb3ee..3e6e37790aac 100644
--- a/usr.sbin/fifolog/fifolog_writer/Makefile
+++ b/usr.sbin/fifolog/fifolog_writer/Makefile
@@ -9,6 +9,8 @@ MAN=
DPADD= ${LIBFIFOLOG} ${LIBUTIL} ${LIBZ}
LDADD= ${LIBFIFOLOG} -lutil -lz
+NO_PIE= yes
+
regress:
date | ./${PROG} -z 0 /tmp/fifolog.0
lptest 65 | ./${PROG} -z 9 /tmp/fifolog.1
diff --git a/usr.sbin/ftp-proxy/ftp-proxy/Makefile b/usr.sbin/ftp-proxy/ftp-proxy/Makefile
index de4988815016..686bac436e1e 100644
--- a/usr.sbin/ftp-proxy/ftp-proxy/Makefile
+++ b/usr.sbin/ftp-proxy/ftp-proxy/Makefile
@@ -14,4 +14,6 @@ DPADD+= ${LIBEVENT}
WARNS?= 3
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/chkprintcap/Makefile b/usr.sbin/lpr/chkprintcap/Makefile
index ffffffbb2bd1..1ea2254f958e 100644
--- a/usr.sbin/lpr/chkprintcap/Makefile
+++ b/usr.sbin/lpr/chkprintcap/Makefile
@@ -11,4 +11,6 @@ CFLAGS+= -I${.CURDIR}/../common_source
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lpc/Makefile b/usr.sbin/lpr/lpc/Makefile
index 35fa52ab138a..65a8010ecda4 100644
--- a/usr.sbin/lpr/lpc/Makefile
+++ b/usr.sbin/lpr/lpc/Makefile
@@ -16,4 +16,6 @@ WARNS?= 0
DPADD= ${LIBLPR} ${LIBEDIT} ${LIBTERMCAP}
LDADD= ${LIBLPR} -ledit -ltermcap
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lpd/Makefile b/usr.sbin/lpr/lpd/Makefile
index 0d7d93ef79d9..bd3e25a8b545 100644
--- a/usr.sbin/lpr/lpd/Makefile
+++ b/usr.sbin/lpr/lpd/Makefile
@@ -12,4 +12,6 @@ WARNS?= 1
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lpq/Makefile b/usr.sbin/lpr/lpq/Makefile
index 4df437e06c32..1c2504b899e5 100644
--- a/usr.sbin/lpr/lpq/Makefile
+++ b/usr.sbin/lpr/lpq/Makefile
@@ -13,4 +13,6 @@ CFLAGS+= -I${.CURDIR}/../common_source
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lpr/Makefile b/usr.sbin/lpr/lpr/Makefile
index 1894b0089c04..cfeebb059d0c 100644
--- a/usr.sbin/lpr/lpr/Makefile
+++ b/usr.sbin/lpr/lpr/Makefile
@@ -18,4 +18,6 @@ WARNS?= 2
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/lprm/Makefile b/usr.sbin/lpr/lprm/Makefile
index 44bc93ac27ec..bd7e321b5501 100644
--- a/usr.sbin/lpr/lprm/Makefile
+++ b/usr.sbin/lpr/lprm/Makefile
@@ -15,4 +15,6 @@ CFLAGS+= -I${.CURDIR}/../common_source
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/lpr/pac/Makefile b/usr.sbin/lpr/pac/Makefile
index bd895a71a305..3a157c9258ca 100644
--- a/usr.sbin/lpr/pac/Makefile
+++ b/usr.sbin/lpr/pac/Makefile
@@ -11,4 +11,6 @@ CFLAGS+= -I${.CURDIR}/../common_source
DPADD= ${LIBLPR}
LDADD= ${LIBLPR}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/mailstats/Makefile b/usr.sbin/mailstats/Makefile
index bd72fc6c5b76..a3cd5623b3f0 100644
--- a/usr.sbin/mailstats/Makefile
+++ b/usr.sbin/mailstats/Makefile
@@ -31,6 +31,8 @@ DPADD+= ${SENDMAIL_DPADD}
LDADD+= ${SENDMAIL_LDADD}
LDFLAGS+= ${SENDMAIL_LDFLAGS}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile
index 62531488128e..0e03fd3e35af 100644
--- a/usr.sbin/makefs/Makefile
+++ b/usr.sbin/makefs/Makefile
@@ -38,4 +38,6 @@ LDADD+= ${LIBNETBSD}
DPADD+= ${LIBSBUF} ${LIBUTIL}
LDADD+= -lsbuf -lutil
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/makemap/Makefile b/usr.sbin/makemap/Makefile
index 80cafcbcfdba..2c2eef555c7b 100644
--- a/usr.sbin/makemap/Makefile
+++ b/usr.sbin/makemap/Makefile
@@ -34,6 +34,8 @@ DPADD+=${SENDMAIL_DPADD}
LDADD+=${SENDMAIL_LDADD}
LDFLAGS+=${SENDMAIL_LDFLAGS}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/nmtree/Makefile b/usr.sbin/nmtree/Makefile
index 9d24c0c4f92f..e09f3c410feb 100644
--- a/usr.sbin/nmtree/Makefile
+++ b/usr.sbin/nmtree/Makefile
@@ -23,4 +23,6 @@ LDADD+= ${LIBNETBSD}
LINKS= ${BINDIR}/mtree ${BINDIR}/nmtree
MLINKS= mtree.8 nmtree.8
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/ntp/ntp-keygen/Makefile b/usr.sbin/ntp/ntp-keygen/Makefile
index 78308fae0ac8..50753508461d 100644
--- a/usr.sbin/ntp/ntp-keygen/Makefile
+++ b/usr.sbin/ntp/ntp-keygen/Makefile
@@ -21,4 +21,6 @@ DPADD+= ${LIBMD} ${LIBCRYPTO}
LDADD+= -lmd -lcrypto
.endif
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/ntp/ntpd/Makefile b/usr.sbin/ntp/ntpd/Makefile
index 87b2d72b8544..3422ad2ad0de 100644
--- a/usr.sbin/ntp/ntpd/Makefile
+++ b/usr.sbin/ntp/ntpd/Makefile
@@ -4,6 +4,8 @@ MAN=
.include <src.opts.mk>
+NO_PIE= yes
+
.PATH: ${.CURDIR}/../../../contrib/ntp/ntpd
PROG= ntpd
diff --git a/usr.sbin/ntp/ntpdate/Makefile b/usr.sbin/ntp/ntpdate/Makefile
index f55ec92bc5d9..ea0fe1e4b2f8 100644
--- a/usr.sbin/ntp/ntpdate/Makefile
+++ b/usr.sbin/ntp/ntpdate/Makefile
@@ -13,6 +13,8 @@ LDADD= ${LIBNTP} -lm -lmd -lrt
CLEANFILES+= .version version.c
+NO_PIE= yes
+
version.c:
sh -e ${.CURDIR}/../scripts/mkver ntpdate
diff --git a/usr.sbin/ntp/ntpdc/Makefile b/usr.sbin/ntp/ntpdc/Makefile
index 81d2671078af..d4ea36f31e49 100644
--- a/usr.sbin/ntp/ntpdc/Makefile
+++ b/usr.sbin/ntp/ntpdc/Makefile
@@ -22,6 +22,8 @@ CFLAGS+= -DHAVE_LIBEDIT -DHAVE_READLINE_READLINE_H \
CLEANFILES+= .version version.c
+NO_PIE= yes
+
version.c:
sh -e ${.CURDIR}/../scripts/mkver ntpdc
diff --git a/usr.sbin/ntp/ntpq/Makefile b/usr.sbin/ntp/ntpq/Makefile
index eb4297341d1c..7fcdd2be3b2d 100644
--- a/usr.sbin/ntp/ntpq/Makefile
+++ b/usr.sbin/ntp/ntpq/Makefile
@@ -24,6 +24,8 @@ CFLAGS+= -DHAVE_LIBEDIT -DHAVE_READLINE_READLINE_H \
CLEANFILES+= .version version.c
+NO_PIE= yes
+
version.c:
sh -e ${.CURDIR}/../scripts/mkver ntpq
diff --git a/usr.sbin/ntp/ntptime/Makefile b/usr.sbin/ntp/ntptime/Makefile
index d3bf7a74cfd9..af3f9051e875 100644
--- a/usr.sbin/ntp/ntptime/Makefile
+++ b/usr.sbin/ntp/ntptime/Makefile
@@ -10,4 +10,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
DPADD= ${LIBNTP}
LDADD= ${LIBNTP}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/praliases/Makefile b/usr.sbin/praliases/Makefile
index 120028d6997b..e1a9a2a79384 100644
--- a/usr.sbin/praliases/Makefile
+++ b/usr.sbin/praliases/Makefile
@@ -34,6 +34,8 @@ LDFLAGS+=${SENDMAIL_LDFLAGS}
DPADD+= ${SENDMAIL_DPADD}
LDADD+= ${SENDMAIL_LDADD}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.sbin/sendmail/Makefile b/usr.sbin/sendmail/Makefile
index 893b6fd0d70a..ffd22bd06a3b 100644
--- a/usr.sbin/sendmail/Makefile
+++ b/usr.sbin/sendmail/Makefile
@@ -7,6 +7,8 @@ SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
SMDIR= ${SENDMAIL_DIR}/src
.PATH: ${SMDIR}
+NO_PIE= yes
+
BINDIR= /usr/libexec/sendmail
PROG= sendmail