Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Introduce NOPIE and NOCTF so that standalone progra...



details:   https://anonhg.NetBSD.org/src/rev/8fdd5a853cb1
branches:  trunk
changeset: 813502:8fdd5a853cb1
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 31 15:30:14 2016 +0000

description:
Introduce NOPIE and NOCTF so that standalone programs build properly.

diffstat:

 share/mk/bsd.lib.mk  |  4 ++--
 share/mk/bsd.own.mk  |  9 ++++++++-
 share/mk/bsd.prog.mk |  4 ++--
 share/mk/bsd.sys.mk  |  4 ++--
 4 files changed, 14 insertions(+), 7 deletions(-)

diffs (77 lines):

diff -r 431100f2e124 -r 8fdd5a853cb1 share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk       Sun Jan 31 15:29:04 2016 +0000
+++ b/share/mk/bsd.lib.mk       Sun Jan 31 15:30:14 2016 +0000
@@ -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 @@
 # 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
diff -r 431100f2e124 -r 8fdd5a853cb1 share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk       Sun Jan 31 15:29:04 2016 +0000
+++ b/share/mk/bsd.own.mk       Sun Jan 31 15:30:14 2016 +0000
@@ -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 @@
 
 .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
diff -r 431100f2e124 -r 8fdd5a853cb1 share/mk/bsd.prog.mk
--- a/share/mk/bsd.prog.mk      Sun Jan 31 15:29:04 2016 +0000
+++ b/share/mk/bsd.prog.mk      Sun Jan 31 15:30:14 2016 +0000
@@ -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 @@
        @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}
diff -r 431100f2e124 -r 8fdd5a853cb1 share/mk/bsd.sys.mk
--- a/share/mk/bsd.sys.mk       Sun Jan 31 15:29:04 2016 +0000
+++ b/share/mk/bsd.sys.mk       Sun Jan 31 15:30:14 2016 +0000
@@ -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 @@
 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 :}



Home | Main Index | Thread Index | Old Index