Received: by mail.netbsd.org (Postfix, from userid 605) id 30C6184D90; Wed, 9 Jan 2019 13:19:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id A812A84D81 for ; Wed, 9 Jan 2019 13:19:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id MKO8P8ya8jYO for ; Wed, 9 Jan 2019 13:19:04 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 1CDB284D20 for ; Wed, 9 Jan 2019 13:19:04 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 169F9FB16; Wed, 9 Jan 2019 13:19:04 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1547039944152800" MIME-Version: 1.0 Date: Wed, 9 Jan 2019 13:19:04 +0000 From: "Thomas Klausner" Subject: CVS commit: pkgsrc/mk To: pkgsrc-changes@NetBSD.org Reply-To: wiz@netbsd.org X-Mailer: log_accum Message-Id: <20190109131904.169F9FB16@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1547039944152800 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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. --_----------=_1547039944152800 Content-Disposition: inline Content-Length: 2713 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii 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. is ${LANGUAGES.} 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 --_----------=_1547039944152800--