Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jun 2017 16:34:17 +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: r320502 - head/share/mk
Message-ID:  <201706301634.v5UGYHgF004258@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Fri Jun 30 16:34:17 2017
New Revision: 320502
URL: https://svnweb.freebsd.org/changeset/base/320502

Log:
  bsd.linker.mk: add band-aid for linker invocation failure
  
  In some cases bsd.linker.mk reports an error like:
  
    make[4]: ".../share/mk/bsd.linker.mk" line 56:
    Unknown linker from LD=ld -m elf32ppc_fbsd:"
  
  For now change this to a .warning, and then assume GNU ld 2.17.50.
  At present the linker type detection is used only for enabling build-id,
  and we can carry on without it when type detection fails.
  
  Also, show errors from ${LD} --version to aid in failure diagnosis.
  Successful invocations of ${LD} --version produce no output on stderr
  so this will not create any spam in non-failing builds.
  
  Tested by:	swills
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D11424

Modified:
  head/share/mk/bsd.linker.mk

Modified: head/share/mk/bsd.linker.mk
==============================================================================
--- head/share/mk/bsd.linker.mk	Fri Jun 30 16:16:21 2017	(r320501)
+++ head/share/mk/bsd.linker.mk	Fri Jun 30 16:34:17 2017	(r320502)
@@ -47,9 +47,9 @@ ${var}=	${${var}.${${X_}_ld_hash}}
 
 .if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD})
 .if !defined(${X_}LINKER_TYPE) || !defined(${X_}LINKER_VERSION)
-_ld_version!=	${${ld}} --version 2>/dev/null | head -n 1 || echo none
+_ld_version!=	(${${ld}} --version || echo none) | head -n 1
 .if ${_ld_version} == "none"
-.error Unable to determine linker type from ${ld}=${${ld}}
+.warning Unable to determine linker type from ${ld}=${${ld}}
 .endif
 .if ${_ld_version:[1..2]} == "GNU ld"
 ${X_}LINKER_TYPE=	bfd
@@ -58,7 +58,9 @@ _v=	${_ld_version:M[1-9].[0-9]*:[1]}
 ${X_}LINKER_TYPE=	lld
 _v=	${_ld_version:[2]}
 .else
-.error Unknown linker from ${ld}=${${ld}}: ${_ld_version}
+.warning Unknown linker from ${ld}=${${ld}}: ${_ld_version}, defaulting to bfd
+${X_}LINKER_TYPE=	bfd
+_v=	2.17.50
 .endif
 ${X_}LINKER_VERSION!=	echo "${_v:M[1-9].[0-9]*}" | \
 			  awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}'



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