Make bsd.linker.mk work with the MacOS linker

This is not strictly required for crossbuilding but having lots of warnings
from bsd.linker.mk in the output was making it hard to see the actual
warning messages.

Reviewed By:	imp
Differential Revision: https://reviews.freebsd.org/D14318
This commit is contained in:
Alex Richardson 2020-08-13 14:14:51 +00:00
parent 54f7867b83
commit 01c4f3a763
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364191

View File

@ -58,7 +58,7 @@ ${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 || echo none) | sed -n 1p
_ld_version!= (${${ld}} -v 2>&1 || echo none) | sed -n 1p
.if ${_ld_version} == "none"
.warning Unable to determine linker type from ${ld}=${${ld}}
.endif
@ -74,6 +74,17 @@ ${X_}LINKER_FREEBSD_VERSION:= ${_ld_version:[4]:C/.*-([^-]*)\)/\1/}
.else
${X_}LINKER_FREEBSD_VERSION= 0
.endif
.elif ${_ld_version:[1]} == "@(\#)PROGRAM:ld"
# bootstrap linker on MacOS
${X_}LINKER_TYPE= mac
_v= ${_ld_version:[2]:S/PROJECT:ld64-//}
# Convert version 409.12 to 409.12.0 so that the echo + awk below works
.if empty(_v:M[1-9]*.[0-9]*.[0-9]*) && !empty(_v:M[1-9]*.[0-9]*)
_v:=${_v}.0
.else
# Some versions do not contain a minor version so we need to append .0.0 there
_v:=${_v}.0.0
.endif
.else
.warning Unknown linker from ${ld}=${${ld}}: ${_ld_version}, defaulting to bfd
${X_}LINKER_TYPE= bfd