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
This commit is contained in:
emaste 2017-06-30 16:34:17 +00:00
parent 112e7bceca
commit e386983c91

View File

@ -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;}'