Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 2017 17:21:37 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
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
Message-ID:  <201706231721.v5NHLb1n032332@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 @@ __<bsd.linker.mk>__:
 # 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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706231721.v5NHLb1n032332>