Source-Changes-HG archive

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

[src/trunk]: src/share/mk Add and document MKRELRO and set x86 to partial by ...



details:   https://anonhg.NetBSD.org/src/rev/69463b0365cd
branches:  trunk
changeset: 345897:69463b0365cd
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jun 14 13:26:45 2016 +0000

description:
Add and document MKRELRO and set x86 to partial by default.

diffstat:

 share/mk/bsd.README |   6 +++++-
 share/mk/bsd.own.mk |  12 +++++++++++-
 share/mk/bsd.sys.mk |  10 +++++++++-
 3 files changed, 25 insertions(+), 3 deletions(-)

diffs (70 lines):

diff -r 1c8bda07f779 -r 69463b0365cd share/mk/bsd.README
--- a/share/mk/bsd.README       Tue Jun 14 13:06:41 2016 +0000
+++ b/share/mk/bsd.README       Tue Jun 14 13:26:45 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.README,v 1.353 2016/03/13 17:56:56 christos Exp $
+#      $NetBSD: bsd.README,v 1.354 2016/06/14 13:26:45 christos Exp $
 #      @(#)bsd.README  8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -369,6 +369,10 @@
 MKPROFILE      If "no", don't build or install the profiling (*_p.a) libraries.
                Default: yes
 
+MKRELRO                If "partial", set the non-PLT GOT to read-only. If "full"
+               also force immediate symbol binding.
+               Default: no
+       
 MKREPRO         If "yes", create reproducable builds. This enables
                different switches to make two builds from the same source tree
                result in the same build results.
diff -r 1c8bda07f779 -r 69463b0365cd share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk       Tue Jun 14 13:06:41 2016 +0000
+++ b/share/mk/bsd.own.mk       Tue Jun 14 13:26:45 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.own.mk,v 1.935 2016/06/10 08:59:26 mrg Exp $
+#      $NetBSD: bsd.own.mk,v 1.936 2016/06/14 13:26:45 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1065,6 +1065,16 @@
 .endif
 
 #
+# RELRO is enabled on i386 and amd64 by default
+#
+.if ${MACHINE_ARCH} == "i386" || \
+    ${MACHINE_ARCH} == "x86_64"
+MKRELRO?=      partial
+.else
+MKRELRO?=      no
+.endif
+
+#
 # MK* options which default to "yes".
 #
 _MKVARS.yes= \
diff -r 1c8bda07f779 -r 69463b0365cd share/mk/bsd.sys.mk
--- a/share/mk/bsd.sys.mk       Tue Jun 14 13:06:41 2016 +0000
+++ b/share/mk/bsd.sys.mk       Tue Jun 14 13:26:45 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.sys.mk,v 1.258 2016/04/12 18:50:45 christos Exp $
+#      $NetBSD: bsd.sys.mk,v 1.259 2016/06/14 13:26:45 christos Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -56,6 +56,14 @@
 # Set assembler warnings to be fatal
 CFLAGS+=       -Wa,--fatal-warnings
 .endif
+
+.if ${MKRELRO:Uno} != "no"
+LDFLAGS+=      -Wl,-z,relro
+.endif
+.if ${MKRELRO:Uno} == "full"
+LDFLAGS+=      -Wl,-z,now
+.endif
+
 # Set linker warnings to be fatal
 # XXX no proper way to avoid "FOO is a patented algorithm" warnings
 # XXX on linking static libs



Home | Main Index | Thread Index | Old Index