From owner-svn-src-head@freebsd.org Thu Jun 22 21:03:25 2017 Return-Path: Delivered-To: svn-src-head@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 52A72D94649; Thu, 22 Jun 2017 21:03:25 +0000 (UTC) (envelope-from bdrewery@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 21203653B6; Thu, 22 Jun 2017 21:03:25 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5ML3OfL026558; Thu, 22 Jun 2017 21:03:24 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5ML3Oq3026557; Thu, 22 Jun 2017 21:03:24 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201706222103.v5ML3Oq3026557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 22 Jun 2017 21:03:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320245 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jun 2017 21:03:25 -0000 Author: bdrewery Date: Thu Jun 22 21:03:24 2017 New Revision: 320245 URL: https://svnweb.freebsd.org/changeset/base/320245 Log: Support XLD for setting X_LINKER_TYPE and X_LINKER_VERSION. This is similar to r300350 for bsd.compiler.mk. MFC after: 2 weeks Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11309 Modified: head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Thu Jun 22 21:03:20 2017 (r320244) +++ head/share/mk/bsd.linker.mk Thu Jun 22 21:03:24 2017 (r320245) @@ -9,25 +9,39 @@ # major * 10000 + minor * 100 + tiny # It too can be overridden on the command line. # +# 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. # .if !target(____) ____: -_ld_version!= ${LD} --version 2>/dev/null | head -n 1 || echo none +.for ld X_ in LD $${_empty_var_} XLD X_ +.if ${ld} == "LD" || !empty(XLD) +.if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) + +_ld_version!= ${${ld}} --version 2>/dev/null | head -n 1 || echo none .if ${_ld_version} == "none" -.error Unable to determine linker type from LD=${LD} +.error Unable to determine linker type from ${ld}=${${ld}} .endif .if ${_ld_version:[1..2]} == "GNU ld" -LINKER_TYPE= binutils +${X_}LINKER_TYPE= binutils _v= ${_ld_version:[3]} .elif ${_ld_version:[1]} == "LLD" -LINKER_TYPE= lld +${X_}LINKER_TYPE= lld _v= ${_ld_version:[2]} .else -.error Unknown linker from LD=${LD}: ${_ld_version} +.error Unknown linker from ${ld}=${${ld}}: ${_ld_version} .endif -LINKER_VERSION!=echo "${_v:M[1-9].[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' +${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \ + awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' +.undef _ld_version +.undef _v +.endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) + +.endif # ${ld} == "LD" || !empty(XLD) +.endfor # .for ld in LD XLD + .endif # !target(____)