1# $FreeBSD$ 2 3# Setup variables for the linker. 4# 5# LINKER_TYPE is the major type of linker. Currently binutils and lld support 6# automatic detection. 7# 8# LINKER_VERSION is a numeric constant equal to: 9# major * 10000 + minor * 100 + tiny 10# It too can be overridden on the command line. 11# 12# This file may be included multiple times, but only has effect the first time. 13# 14 15.if !target(__<bsd.linker.mk>__) 16__<bsd.linker.mk>__: 17 18_ld_version!= ${LD} --version 2>/dev/null | head -n 1 || echo none 19.if ${_ld_version} == "none" 20.error Unable to determine linker type from LD=${LD} 21.endif 22.if ${_ld_version:[1..2]} == "GNU ld" 23LINKER_TYPE= binutils 24_v= ${_ld_version:[3]} 25.elif ${_ld_version:[1]} == "LLD" 26LINKER_TYPE= lld 27_v= ${_ld_version:[2]} 28.else 29.error Unknown linker from LD=${LD}: ${_ld_version} 30.endif 31LINKER_VERSION!=echo "${_v:M[1-9].[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' 32 33.endif # !target(__<bsd.linker.mk>__) 34