Module Name: src Committed By: christos Date: Sun Jan 31 15:30:14 UTC 2016
Modified Files: src/share/mk: bsd.lib.mk bsd.own.mk bsd.prog.mk bsd.sys.mk Log Message: Introduce NOPIE and NOCTF so that standalone programs build properly. To generate a diff of this commit: cvs rdiff -u -r1.362 -r1.363 src/share/mk/bsd.lib.mk cvs rdiff -u -r1.889 -r1.890 src/share/mk/bsd.own.mk cvs rdiff -u -r1.294 -r1.295 src/share/mk/bsd.prog.mk cvs rdiff -u -r1.250 -r1.251 src/share/mk/bsd.sys.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/mk/bsd.lib.mk diff -u src/share/mk/bsd.lib.mk:1.362 src/share/mk/bsd.lib.mk:1.363 --- src/share/mk/bsd.lib.mk:1.362 Tue Sep 8 12:06:42 2015 +++ src/share/mk/bsd.lib.mk Sun Jan 31 10:30:14 2016 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.362 2015/09/08 16:06:42 uebayasi Exp $ +# $NetBSD: bsd.lib.mk,v 1.363 2016/01/31 15:30:14 christos Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include <bsd.init.mk> @@ -42,7 +42,7 @@ realinstall: checkver libinstall # XXX: This is needed for programs that link with .a libraries # Perhaps a more correct solution is to always generate _pic.a # files or always have a shared library. -.if defined(MKPIE) && (${MKPIE} != "no") +.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE) CFLAGS+= ${PIE_CFLAGS} AFLAGS+= ${PIE_AFLAGS} .endif Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.889 src/share/mk/bsd.own.mk:1.890 --- src/share/mk/bsd.own.mk:1.889 Fri Jan 29 10:33:51 2016 +++ src/share/mk/bsd.own.mk Sun Jan 31 10:30:14 2016 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.889 2016/01/29 15:33:51 christos Exp $ +# $NetBSD: bsd.own.mk,v 1.890 2016/01/31 15:30:14 christos Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -528,6 +528,13 @@ TOOL_ZIC= zic .endif # USETOOLS != yes # } +# Standalone code should not be compiled with PIE or CTF +# Should create a better test +.if defined(BINDIR) && ${BINDIR} == "/usr/mdec" +NOPIE= # defined +NOCTF= # defined +.endif + # Fallback to ensure that all variables are defined to something TOOL_CC.false= false TOOL_CPP.false= false Index: src/share/mk/bsd.prog.mk diff -u src/share/mk/bsd.prog.mk:1.294 src/share/mk/bsd.prog.mk:1.295 --- src/share/mk/bsd.prog.mk:1.294 Sat Jan 23 16:22:47 2016 +++ src/share/mk/bsd.prog.mk Sun Jan 31 10:30:14 2016 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prog.mk,v 1.294 2016/01/23 21:22:47 christos Exp $ +# $NetBSD: bsd.prog.mk,v 1.295 2016/01/31 15:30:14 christos Exp $ # @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 .ifndef HOSTPROG @@ -48,7 +48,7 @@ CLEANFILES+=strings @rm -f x.cc .endif -.if defined(MKPIE) && (${MKPIE} != "no") +.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE) CFLAGS+= ${PIE_CFLAGS} AFLAGS+= ${PIE_AFLAGS} LDFLAGS+= ${PIE_LDFLAGS} Index: src/share/mk/bsd.sys.mk diff -u src/share/mk/bsd.sys.mk:1.250 src/share/mk/bsd.sys.mk:1.251 --- src/share/mk/bsd.sys.mk:1.250 Sun Jan 10 11:22:57 2016 +++ src/share/mk/bsd.sys.mk Sun Jan 31 10:30:14 2016 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.sys.mk,v 1.250 2016/01/10 16:22:57 christos Exp $ +# $NetBSD: bsd.sys.mk,v 1.251 2016/01/31 15:30:14 christos Exp $ # # Build definitions used for NetBSD source tree builds. @@ -174,7 +174,7 @@ CPUFLAGS+= -Wa,--fatal-warnings CFLAGS+= ${CPUFLAGS} AFLAGS+= ${CPUFLAGS} -.if !defined(LDSTATIC) || ${LDSTATIC} != "-static" +.if !defined(NOPIE) && (!defined(LDSTATIC) || ${LDSTATIC} != "-static") # Position Independent Executable flags PIE_CFLAGS?= -fPIC PIE_LDFLAGS?= -Wl,-pie ${${ACTIVE_CC} == "gcc":? -shared-libgcc :}