pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk



Module Name:    pkgsrc
Committed By:   wiz
Date:           Wed Jan  9 13:19:03 UTC 2019

Modified Files:
        pkgsrc/mk/compiler: clang.mk
        pkgsrc/mk/platform: Linux.mk NetBSD.mk

Log Message:
Add RELRO support for clang, based on the gcc logic.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 pkgsrc/mk/compiler/clang.mk
cvs rdiff -u -r1.78 -r1.79 pkgsrc/mk/platform/Linux.mk
cvs rdiff -u -r1.57 -r1.58 pkgsrc/mk/platform/NetBSD.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/compiler/clang.mk
diff -u pkgsrc/mk/compiler/clang.mk:1.19 pkgsrc/mk/compiler/clang.mk:1.20
--- pkgsrc/mk/compiler/clang.mk:1.19    Mon Nov 12 14:22:58 2018
+++ pkgsrc/mk/compiler/clang.mk Wed Jan  9 13:19:03 2019
@@ -1,4 +1,4 @@
-# $NetBSD: clang.mk,v 1.19 2018/11/12 14:22:58 jperkin Exp $
+# $NetBSD: clang.mk,v 1.20 2019/01/09 13:19:03 wiz Exp $
 #
 # This is the compiler definition for the clang compiler.
 #
@@ -55,6 +55,13 @@ _COMPILER_RPATH_FLAG=        ${_COMPILER_LD_FLA
 
 _CTF_CFLAGS=           -gdwarf-2
 
+# The user can choose the level of RELRO.
+.if ${PKGSRC_USE_RELRO} == "partial"
+_RELRO_LDFLAGS=                -Wl,-z,relro
+.else
+_RELRO_LDFLAGS=                -Wl,-z,relro -Wl,-z,now
+.endif
+
 # The user can choose the level of stack smashing protection.
 .if ${PKGSRC_USE_SSP} == "all"
 _SSP_CFLAGS=           -fstack-protector-all
@@ -62,6 +69,13 @@ _SSP_CFLAGS=         -fstack-protector-all
 _SSP_CFLAGS=           -fstack-protector
 .endif
 
+.if ${_PKGSRC_USE_RELRO} == "yes"
+_CLANG_LDFLAGS+=       ${_RELRO_LDFLAGS}
+CWRAPPERS_APPEND.ld+=  ${_RELRO_LDFLAGS}
+.endif
+
+LDFLAGS+=      ${_CLANG_LDFLAGS}
+
 # _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the
 # ones requested by the package in USE_LANGUAGES.
 #

Index: pkgsrc/mk/platform/Linux.mk
diff -u pkgsrc/mk/platform/Linux.mk:1.78 pkgsrc/mk/platform/Linux.mk:1.79
--- pkgsrc/mk/platform/Linux.mk:1.78    Tue Nov 21 19:16:47 2017
+++ pkgsrc/mk/platform/Linux.mk Wed Jan  9 13:19:03 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Linux.mk,v 1.78 2017/11/21 19:16:47 bsiegert Exp $
+# $NetBSD: Linux.mk,v 1.79 2019/01/09 13:19:03 wiz Exp $
 #
 # Variable definitions for the Linux operating system.
 
@@ -131,7 +131,7 @@ _OPSYS_MAX_CMDLEN_CMD?=     /usr/bin/getconf
 _OPSYS_SUPPORTS_FORTIFY=yes
 .endif
 
-# Register support for RELRO on supported architectures (with GCC)
+# Register support for RELRO on supported architectures
 .if (${MACHINE_ARCH} == "i386") || \
     (${MACHINE_ARCH} == "x86_64")
 _OPSYS_SUPPORTS_RELRO= yes

Index: pkgsrc/mk/platform/NetBSD.mk
diff -u pkgsrc/mk/platform/NetBSD.mk:1.57 pkgsrc/mk/platform/NetBSD.mk:1.58
--- pkgsrc/mk/platform/NetBSD.mk:1.57   Sun Nov 12 13:34:14 2017
+++ pkgsrc/mk/platform/NetBSD.mk        Wed Jan  9 13:19:03 2019
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.mk,v 1.57 2017/11/12 13:34:14 khorben Exp $
+# $NetBSD: NetBSD.mk,v 1.58 2019/01/09 13:19:03 wiz Exp $
 #
 # Variable definitions for the NetBSD operating system.
 
@@ -136,7 +136,7 @@ _OPSYS_SUPPORTS_FORTIFY=yes
 _OPSYS_SUPPORTS_MKPIE= yes
 .endif
 
-# Register support for RELRO on supported architectures (with GCC)
+# Register support for RELRO on supported architectures
 .if (${MACHINE_ARCH} == "i386") || \
     (${MACHINE_ARCH} == "x86_64")
 _OPSYS_SUPPORTS_RELRO= yes



Home | Main Index | Thread Index | Old Index