From owner-svn-src-all@freebsd.org Fri Jun 23 17:21:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12FC9DA8CC9; Fri, 23 Jun 2017 17:21:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2E166897A; Fri, 23 Jun 2017 17:21:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5NHLc9t032335; Fri, 23 Jun 2017 17:21:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5NHLb1n032332; Fri, 23 Jun 2017 17:21:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201706231721.v5NHLb1n032332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Jun 2017 17:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320275 - in head: share/mk sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jun 2017 17:21:39 -0000 Author: emaste Date: Fri Jun 23 17:21:37 2017 New Revision: 320275 URL: https://svnweb.freebsd.org/changeset/base/320275 Log: Introduce LINKER_FEATURES to avoid duplicating version logic Submitted by: bdrewery Reported by: kib Modified: head/share/mk/bsd.linker.mk head/sys/conf/kern.pre.mk head/sys/conf/kmod.mk Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Fri Jun 23 16:38:46 2017 (r320274) +++ head/share/mk/bsd.linker.mk Fri Jun 23 17:21:37 2017 (r320275) @@ -9,6 +9,11 @@ # major * 10000 + minor * 100 + tiny # It too can be overridden on the command line. # +# LINKER_FEATURES may contain one or more of the following, based on +# linker support for that feature: +# +# - build-id : support for generating a Build-ID note +# # These variables with an X_ prefix will also be provided if XLD is set. # # This file may be included multiple times, but only has effect the first time. @@ -22,7 +27,7 @@ ____: # Try to import LINKER_TYPE and LINKER_VERSION from parent make. # The value is only used/exported for the same environment that impacts # LD and LINKER_* settings here. -_exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION +_exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION ${X_}LINKER_FEATURES ${X_}_ld_hash= ${${ld}}${MACHINE}${PATH} ${X_}_ld_hash:= ${${X_}_ld_hash:hash} # Only import if none of the vars are set somehow else. @@ -59,11 +64,16 @@ ${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \ awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .undef _ld_version .undef _v +${X_}LINKER_FEATURES= +.if ${${X_}LINKER_TYPE} != "bfd" || ${${X_}LINKER_VERSION} > 21750 +${X_}LINKER_FEATURES+= build-id .endif +.endif .else # Use LD's values X_LINKER_TYPE= ${LINKER_TYPE} X_LINKER_VERSION= ${LINKER_VERSION} +X_LINKER_FEATURES= ${LINKER_FEATURES} .endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) # Export the values so sub-makes don't have to look them up again, using the Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Fri Jun 23 16:38:46 2017 (r320274) +++ head/sys/conf/kern.pre.mk Fri Jun 23 17:21:37 2017 (r320275) @@ -114,7 +114,7 @@ DEFINED_PROF= ${PROF} # can override the others. CFLAGS+= ${CONF_CFLAGS} -.if ${LINKER_TYPE} != "bfd" || ${LINKER_VERSION} > 21750 +.if ${LINKER_FEATURES:Mbuild-id} LDFLAGS+= -Wl,--build-id=sha1 .endif Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Fri Jun 23 16:38:46 2017 (r320274) +++ head/sys/conf/kmod.mk Fri Jun 23 17:21:37 2017 (r320275) @@ -125,7 +125,7 @@ CFLAGS.gcc+= --param large-function-growth=1000 CFLAGS+= -fno-common LDFLAGS+= -d -warn-common -.if ${LINKER_TYPE} != "bfd" || ${LINKER_VERSION} > 21750 +.if ${LINKER_FEATURES:Mbuild-id} LDFLAGS+= -Wl,--build-id=sha1 .endif